Repositioning controls when the orientation changes

后端 未结 5 425
醉酒成梦
醉酒成梦 2021-02-04 09:01

I know Auto Layout can be used to make the sizes and position consistent when the orientation changes. Is it possible to completely change the layout when the orientation change

5条回答
  •  日久生厌
    2021-02-04 09:24

    When using autolayout you can override updateViewConstraints to modify the layout on orientation change:

    - (void)updateViewConstraints{
    
      [super updateViewConstraints];
      //portrait
      if(UIInterfaceOrientationIsPortrait(self.interfaceOrientation)){
    
      }
      //landscape
      else{
        //
      }
    }
    

提交回复
热议问题