Make subview rotate too when device is rotated iPhone/iPad

那年仲夏 提交于 2019-11-29 07:28:32

Define shouldAutorotateToInterfaceOrientation: in you UIViewController so that it always returns YES:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
 {
    return YES;
 }

Look here for more details.

You should also take care to correctly define the autoresizing behavior of your view and subviews, so that everything is fine when autorotating.

EDIT:

to set the autoresize property for a view in Interface Builder, select the view then go to the "View Size" pane in the Info window and set "Autosizing" as in the image below.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!