【发布时间】:2011-07-03 21:50:24
【问题描述】:
我正在处理推送通知。当单击通知中的操作按钮时,我正在尝试在 navigationController 中创建和推送 DetailView。但导航控制器为零。我怎样才能把那个DetailView放在navigationController中?我想在 navigationController 中推送 RootViewController,然后在 DetailView 中推送。我该怎么做?
在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];
这是我现在使用的代码。请注意我有
[self.tableView reloadData];
【问题讨论】:
-
doStuff 是您要在其中显示详细视图的位置吗?
标签: iphone objective-c cocoa-touch uinavigationcontroller apple-push-notifications