【问题标题】:IOS - viewWillAppear vs viewWillLayoutSubviews - NSLayoutConstraint- extension keyboardIOS - viewWillAppear vs viewWillLayoutSubviews - NSLayoutConstraint- 扩展键盘
【发布时间】:2014-11-20 14:22:47
【问题描述】:

我的扩展键盘有一个 NSLayoutConstraint *heightConstraint。它根据纵向和横向模式而变化。

  • 如果我写在 viewWillAppear 函数中;它在键盘第一次执行时有效,但不适用于纵向->横向或横向->纵向情况。
  • 如果我写在 viewWillLayoutSubviews 中;第一次执行键盘时它不起作用,但当状态栏改变时它可以正常工作。
  • 如果我在两个函数中都编写它,它就不起作用。
  • 如果我在 updateViewConstraints 函数中编写它,然后在其他两个函数中调用它,它也不起作用。

请帮助我在几个小时内试图找到解决方案

【问题讨论】:

    标签: ios keyboard nslayoutconstraint viewwillappear


    【解决方案1】:

    通过使用解决 -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 函数而不是 willLayoutSubvieww

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-06
      • 2016-02-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多