0
我想讓我的應用程序在用戶單擊「提交」按鈕後切換視圖。在基於分割的應用程序中手動更改視圖
這是我到目前爲止有:
viewA.h
@property (nonatomic, retain) RootViewController *root;
viewA.m
-(void)switchToLogView{
NSLog(@"switch to log view");
UIViewController <SubstitutableDetailViewController> *detailViewController = nil;
LogDetailViewController *newDetailViewController = [[LogDetailViewController alloc] initWithNibName:@"LogDetailViewController" bundle:nil];
detailViewController = newDetailViewController;
// Update the split view controller's view controllers array.
NSArray *viewControllers = [[NSArray alloc] initWithObjects:self.navigationController, detailViewController, nil];
root.splitViewController.viewControllers = viewControllers;
// Dismiss the popover if it's present.
if (root.popoverController != nil) {
[root.popoverController dismissPopoverAnimated:YES];
}
// Configure the new view controller's popover button (after the view has been displayed and its toolbar/navigation bar has been created).
if (root.rootPopoverButtonItem != nil) {
[detailViewController showRootPopoverButtonItem:self.root.rootPopoverButtonItem];
}
[detailViewController release];
}
的splitViewController
,popoverController
和rootPopoverButtonItem
都在我的RootViewController
類中聲明(我從蘋果示例代碼開始)。
代碼生成的很好,但是當我調用方法時,什麼都不會發生。
謝謝,我會試試這個! – BloonsTowerDefence 2012-07-19 16:39:47
嗯這種作品。它提供了我想要的視圖,但它不給我菜單按鈕('rootPopoverButtonItem'),這是我需要導航應用程序 – BloonsTowerDefence 2012-07-19 16:52:34
虐待只是發佈一個新問題 – BloonsTowerDefence 2012-07-19 17:09:30