1
我有一個UISplitViewController(完美的工作),我想顯示頂部的按鈕,以縱向模式顯示彈出菜單。iPad:沒有「彈出按鈕」的UISplitViewController?
的AppDelegate代碼
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
splitViewController = [[MySplitViewController alloc] init];
MasterViewController *master = [[MasterViewController alloc] init];
PicsTableViewController *detail = [[PicsTableViewController alloc] init];
//create NavigationControllers
UINavigationController *masterNav = [[UINavigationController alloc] initWithRootViewController:master];
UINavigationController *detailNav = [[UINavigationController alloc] initWithRootViewController:detail];
[master release];
splitViewController.viewControllers = [NSArray arrayWithObjects:masterNav, detailNav, nil];
[masterNav release]; [detailNav release];
splitViewController.delegate = detail;
[detail release];
[self.window addSubview:splitViewController.view];
[self.window makeKeyAndVisible];
return YES;
}
PicsTableViewController(代表)代碼:
//add button on top
- (void)splitViewController:(UISplitViewController *)svc
willHideViewController:(UIViewController *)aViewController
withBarButtonItem:(UIBarButtonItem*)barButtonItem
forPopoverController:(UIPopoverController*)pc
{
barButtonItem.title = aViewController.title;
self.navigationItem.rightBarButtonItem = barButtonItem;
}
- (void)splitViewController:(UISplitViewController *)svc
willShowViewController:(UIViewController *)aViewController
invalidatingBarButtonItem:(UIBarButtonItem *)button
{
self.navigationItem.rightBarButtonItem = nil;
}
按鈕一直沒有出現,這有什麼錯我的代碼? 謝謝