我想要開始使用導航控制器教程,但我找不到其中有多個導航控制器的教程。多導航控制器
到目前爲止我有以下代碼:第一頁是一個簡單的主菜單使用UIViewController
。通過按第一個按鈕,用戶可以使用UINavigationController
訪問客戶列表頁面,並且客戶列表頁面的導航欄上正確顯示了「返回」按鈕。
以我的應用程序委託,我有以下代碼:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
在視圖控制器,其負責顯示的客戶名單,後退按鈕調用下面的方法:
- (void)backHome:(id)sender {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
ViewController *viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
appDelegate.window.rootViewController = viewController;
[self.navigationController popToViewController:viewController animated:YES];
// self.window.rootViewController = self.viewController;
[appDelegate.window makeKeyAndVisible];
}
但它停止工作。我不知道我該如何做這項工作。
英文。格式化。空白。縮進。文檔。努力。 – 2012-08-12 08:05:48