如何在iOS6中自动调整子视图?

时间:2013-09-28 15:46:38

标签: ios objective-c

在iOS6中,autorotate与以前的版本不同,因为它应该与UINavigation一起使用。我有一个带有UINavigation栏的View_A,它有pushViewController:View_B和View_B pushViewController:C。所以View_A,View_B和View_C都可以自动旋转。我的问题是,如果在View_C中我使用addsubview将View_D添加为子视图,View_D不会自动旋转。我不知道如何在iOS 6中自动调整子视图。有人和我有同样的问题吗?

1 个答案:

答案 0 :(得分:0)

试试这段代码:

 -  (BOOL)shouldAutorotate {

UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];

            if (orientation==UIInterfaceOrientationPortrait) {
         // do the UI changes

            }
         if(orientation==UIInterfaceOrientationLandscape){
         // do UI changes 
           }

return YES;

}