Repositioning controls when the orientation changes

后端 未结 5 427
醉酒成梦
醉酒成梦 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:25

    you cant set frames differently : -

    -(void)setFramesForPotrait
    {
    
    // set frames here
    
    }
    
    -(void)setFramesForLandscaeMode
    {
    
    // set frames here
    
    }
    
    -(bool)shouldAutorotate.....
    {
    return Yes
    }
    
    -()willAutoRotate......
    {
    if(orientation = uiinterfaceOrientationPotrait)
    {
    [self setFramesForPotrait];
    }
    else
    {
    [self setFramesForLandscape];
    }
    

提交回复
热议问题