我的应用是基于导航的。其中我有一个主 tableView,它显示单元格中的提要项目。单击单元格时,会创建一个详细视图,其中显示该提要项目的详细信息。我现在正在处理推送通知。单击通知中的操作按钮时,
(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo:
叫做。如果单击通知中的操作按钮,我如何实现该方法。它应该再次解析提要,重新加载表格视图,创建最新的提要项目详细视图并将其推送到导航堆栈中。我尝试了一些代码,但没有用。这是我写的代码。
在 AppDelegate 中:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
RootViewController *controller = [[RootViewController alloc] init];
[controller newFeedItem];
}
在 RootViewController 中:
- (void)newFeedItem
{
spinner = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.frame=CGRectMake(130, 170, 50, 50);
[self.view addSubview:spinner];
[spinner startAnimating];
[self performSelector:@selector(doStuff) withObject:nil afterDelay:0.01];
}
-(void)doStuff
{
[[self stories] removeAllObjects];
[self startParsing];
[self.tableView reloadData];
// create detailview and push it in navigational stack
[spinner stopAnimating];
[spinner release];
}
但活动指示器没有出现,tableView 也没有重新加载。为什么会这样?提前感谢