我刚刚切换到 iOS7 SDK。我的应用程序在此之前在 iOS6 上运行良好,但现在在 iOS7 上运行良好。
我有一个带有页面控件的 scrollView 来显示具有以下设置的 3 个不同的选项卡:
self.scrollView.pagingEnabled = YES;
self.scrollView.contentSize = CGSizeMake(self.scrollView.frame.size.width * 3, self.scrollView.frame.size.height);
self.scrollView.showsHorizontalScrollIndicator = NO;
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.scrollsToTop = NO;
self.scrollView.delegate = self;
我在这个 scrollView 上添加了我从 3 个不同的故事板加载的 3 个视图:
UIStoryboard *timelineStoryboard=[UIStoryboard storyboardWithName:@"timelineStoryboard" bundle:nil];
TabBarViewController *mainVC=[timelineStoryboard instantiateInitialViewController];
self.currentViewController =mainVC;
[mainVC.view setFrame:CGRectMake(320, 20, mainVC.view.frame.size.width, mainVC.view.frame.size.height)];
[self.scrollView addSubview:mainVC.view];
[self addChildViewController:mainVC];
UIStoryboard *expenseStoryboard=[UIStoryboard storyboardWithName:@"expenseStoryboard" bundle:nil];
TabBarViewController *leftVC=[expenseStoryboard instantiateInitialViewController];
self.leftViewController =leftVC;
[leftVC.view setFrame:CGRectMake(0, 20, leftVC.view.frame.size.width, leftVC.view.frame.size.height)];
[self.leftViewController.view setFrame:CGRectMake(0, 20, leftVC.view.frame.size.width, leftVC.view.frame.size.height)];
[self.scrollView addSubview:leftVC.view];
[self addChildViewController:leftVC];
UIStoryboard *dashboardStoryboard=[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
TabBarViewController *rightVC=[dashboardStoryboard instantiateViewControllerWithIdentifier:@"dashboardVC"];
self.leftViewController =rightVC;
[rightVC.view setFrame:CGRectMake(640, 20, rightVC.view.frame.size.width, rightVC.view.frame.size.height)];
[self.scrollView addSubview:rightVC.view];
[self addChildViewController:rightVC];
在 iOS6 上,这 3 个视图彼此重叠显示,而在 iOS7 上,它们正确显示(横坐标为 0,一个 x=320,另一个 x=640)。有谁知道如何解决这个问题?
非常感谢