【发布时间】:2011-08-23 12:53:40
【问题描述】:
在我的应用程序中有两个 viewController,分别是 FirstViewController 和 DetailViewController。
当点击表格单元格时,它会导航到DetailViewController。在DetailViewController,我想编辑并重新加载FirstViewController的表格视图
如何使用NSNotification 解决这个问题?
这是我要实现的方法NSNotification stuff
-(IBAction) save{
strSelectedText=theTextField.text;
[NSNotificationCenter defaultCenter];
NSNotification* notification = [NSNotification notificationWithName:@"MyNotification" object:self];
[[NSNotificationCenter defaultCenter] postNotification:notification];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector (objFirstViewController) name:@"MyNotification" object:nil];
[self.navigationController popViewControllerAnimated:YES];
}
【问题讨论】:
-
这不是通知任务。看看 TableViewProgrammingGuide。你可以从这里开始:developer.apple.com/library/mac/#documentation/cocoa/Conceptual/…HTH
-
我建议,你最好使用委托模式而不是通知。
标签: iphone objective-c ios ios4