我怀疑。 我的应用程序中有两个Storyboard和一个UITabBarController。在方法“viewDidLoad”中,我创建了两个故事板(主要和选择)和我的tabBarController。这在肖像模式下完美无缺。
现在,我需要更新我的应用,以横向模式工作。我刚刚添加了约束并更新为autolayout和size类。但是,一旦实例化,我就无法改变故事板的大小。
主要故事板(绿色),运作完美,但第二个故事板“选择”(蓝色)在运行后不会更新大小。
如果模拟器处于横向模式,则其工作正常,但如果我将模拟器旋转为纵向模式,则无效。
为了更好地理解,主要是绿色,选择是蓝色。
Ps:如果我再次调用viewDidLoad,当我旋转时,它会起作用,但我会重新创建,我不想要这个。我只想旋转并且对象正确对齐。
查看图片: https://drive.google.com/open?id=0B88fyw4P16mGOTlQS29PaFZJRUU
我的源代码:
- (void)viewDidLoad {
self.selectionViewController = [[UIStoryboard storyboardWithName:@"SelectionScreen" bundle:nil] instantiateInitialViewController];
[mainScreenTabs addObject:self.SelectionViewController];
// Instantiate TabBarController from the MainScreen Storyboard and set it to the main view
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainScreen" bundle:nil];
self.mainTabsController = [mainStoryboard instantiateViewControllerWithIdentifier:@"MainTabsVC"];
[self.mainTabsController setViewControllers:mainScreenTabs];
[self.viewMain addSubview:self.mainTabsController.view];