我正在使用推送通知。我試圖在通知中的操作按鈕被點擊時在navigationController中創建並推送一個DetailView。但navigationController是零。我怎樣才能把那個DetailView放在navigationController中?我想在navigationController中推入RootViewController,然後在DetailView中推送RootViewController。我怎樣才能做到這一點?如何通過UINavigationController設置navigationController?
在的AppDelegate:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
RootViewController *controller = [[RootViewController alloc] init];
//getting warnings here.(Unused variable navigationController)
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
[controller doStuff];
[controller release];
}
在RootViewController的:
-(void)doStuff{
[[self stories] removeAllObjects];
[self startParsing];
[self.tableView reloadData];
DetailViewController *detail = [[DetailViewController alloc] init];
//custom code
[self.navigationController pushViewController:detail animated:YES];
[detail release];
這是使用的是現在的代碼讀音字。而PLZ注意到我
[self.tableView reloadData];
是你想要顯示detailView的doStuff嗎? – 2011-02-25 00:13:41
是。我認爲它可能 – Piscean 2011-02-25 00:15:57