IOS - viewWillAppear vs viewWillLayoutSubviews - NSLayoutConstraint-扩展键盘

时间:2014-11-20 14:22:48

标签: ios keyboard nslayoutconstraint viewwillappear

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

  • 如果我在viewWillAppear函数中写入它;它在键盘首次执行时有效,但它不适用于纵向 - >横向或横向 - >纵向情况。
  • 如果我在viewWillLayoutSubviews中写它;键盘首次执行时它不起作用,但在statusbarchanged时它可以正常工作。
  • 如果我用两个函数编写它,它就不起作用。
  • 如果我在updateViewConstraints函数中编写它,那么在其它两个函数中调用它,它也不起作用。

请帮助我尝试找几个小时的解决方案

1 个答案:

答案 0 :(得分:0)

使用解决 - (无效)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 功能而不是willLayoutSubvieww