IOS - viewWillAppear vs viewWillLayoutSubviews - NSLayoutConstraint- extension keyboard

609 views Asked by At

I have an NSLayoutConstraint *heightConstraint for my extension keyboard. It changes according to portrait and landscape mode.

  • If I write it in viewWillAppear function; it works when keyboard first executed but it doesn't work for portrait->landscape or landscape->portrait situations.
  • If I write it in viewWillLayoutSubviews; it doesn't work when keyboard first executed but it works properly when statusbarchanged.
  • If I write it in both two functions it doesn't work.
  • If I write it in updateViewConstraints function then call it in other two functions it doesn't work also.

Please help I'm trying to find a solution for hours

1

There are 1 answers

0
user1720057 On BEST ANSWER

Solved by using -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation function instead of willLayoutSubvieww