2
我有打開SPLITVIEW控制器/默認隱藏菜單用手勢如何刪除splitviewcontroller的姿態iOS7
這是一個好主意,有它無需編碼任何東西,但作爲你看,我添加了與姿勢工作的旋轉木馬,但分割菜單的姿態禁用旋轉木馬的流動性,這是我獲得UISplitViewController代碼:
代碼用於顯示拆分視圖控制器
InitialVC.m:
-(void)viewDidAppear:(BOOL)animated{
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
if ([[[UIDevice currentDevice]model] hasPrefix:@"iPad"]){
ViewController *rightViewController = [storyBoard instantiateViewControllerWithIdentifier:@"ViewController"];
rightViewController.navigationItem.titleView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:LOGO_COMPANY]];
[functions showSplitViewControllerInView:self.view withDetailViewController:rightViewController];
}
}
Functions.m:
-(void)showSplitViewControllerInView:(UIView *)view
withDetailViewController:(id)rightViewController{
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"iPad" bundle: nil];
UINavigationController *leftNavController;
UINavigationController *rightNavController;
MenuPrincipalVC *leftViewController = [mainStoryboard instantiateViewControllerWithIdentifier:@"MenuPrincipalVC"];
leftNavController = [[UINavigationController alloc] initWithRootViewController:leftViewController];
rightNavController = [[UINavigationController alloc] initWithRootViewController:rightViewController];
leftNavController.toolbarHidden = FALSE;
rightNavController.toolbarHidden = FALSE;
leftNavController.navigationBar.translucent = TRUE;
rightNavController.navigationBar.translucent = TRUE;
leftNavController.toolbar.translucent = FALSE;
rightNavController.toolbar.translucent = TRUE;
UISplitViewController *splitViewController = [[UISplitViewController alloc] init];
splitViewController.viewControllers = [NSArray arrayWithObjects:leftNavController, rightNavController, nil];
splitViewController.delegate = rightViewController;
view.window.rootViewController = splitViewController;
}
CODE用於顯示/ HIDDING按鈕菜單上的詳細視圖CONTROLLER
ViewController.m:
#pragma mark - UISplitViewDelegate methods
-(void)splitViewController:(UISplitViewController *)svc
willHideViewController:(UIViewController *)aViewController
withBarButtonItem:(UIBarButtonItem *)barButtonItem
forPopoverController:(UIPopoverController *)pc{
//Grab a reference to the popover
self.popover = pc;
[barButtonItem setImage:[UIImage imageNamed:@"menuButton.png"]];
UINavigationItem *navItem = self.navigationItem;
[navItem setLeftBarButtonItem:barButtonItem animated:YES];
}
-(void)splitViewController:(UISplitViewController *)svc
willShowViewController:(UIViewController *)aViewController
invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem{
//Remove the barButtonItem.
[_navBarItem setLeftBarButtonItem:nil animated:YES];
//Nil out the pointer to the popover.
_popover = nil;
}
#pragma mark -
它的作品!謝謝 – Jesus