不會改變我一直在使用拆分視圖在我的應用程序。
當我在IOS 6模擬器運行我應用它旋轉按方位的變化,並且效果很好,但是當我在IOS 5或iOS運行相同的應用程序5.1模擬器和我改變模擬器但分割視圖中未變化每取向變化的取向。
我還添加代碼UISplitview取向的iOS 5和iOS 5.1
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
-(BOOL)shouldAutorotate
{
return YES;
}
我使用以下代碼 添加拆分視圖 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 返回YES; }
上述工作在主視圖和詳細視圖方法。
我用下面的代碼
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
// obj_PageControlViewController = [[PageControlViewController alloc]initWithNibName:@"PageControlViewController-iPad" bundle:nil];
MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController_iPad" bundle:nil];
UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController_iPad" bundle:nil];
UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
masterViewController.detailViewController = detailViewController;
self.splitViewController = [[UISplitViewController alloc] init];
self.splitViewController.delegate = detailViewController;
self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController];
TabBarAppDelegate *appDelegate = (TabBarAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate.window setRootViewController:self.splitViewController];
}
,但它不能正常工作添加拆分視圖。任何人都可以幫助我?
您是否在項目摘要中選擇了支持的界面方向? (點擊左側欄上的項目,然後在第一部分的中間窗口中選擇您的應用可支持的所有方向) – rdurand
否我的項目概要中沒有選擇方向。 –