如何在 uisplitviewcontroller 中关闭 NavigationController 后重新加载 tableView?
我使用 UISplitviewController
作为模板。
编辑按钮的操作:
newExViewController *editWindow =[[newExViewController alloc]initWithNibName:@"newExViewController" bundle:nil];
UINavigationController *navBar=[[UINavigationController alloc]initWithRootViewController:editWindow];
navBar.modalPresentationStyle = UIModalPresentationFormSheet;
navBar.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:navBar animated:YES];
[navBar release];
[editWindow release];
navBar
有一个用于 saveButton 的 UIBarButton
。 现在,当您按下 SaveButton 时会调用此方法,这
[self dismissModalViewControllerAnimated:YES];
就是问题所在: 知道如何在 modalView 关闭时重新加载主 NavigationConteroller 和DetailViewController 的数据吗? 我不知道 谢谢
I'm using a UISplitviewController
as a template.
action for edit button:
newExViewController *editWindow =[[newExViewController alloc]initWithNibName:@"newExViewController" bundle:nil];
UINavigationController *navBar=[[UINavigationController alloc]initWithRootViewController:editWindow];
navBar.modalPresentationStyle = UIModalPresentationFormSheet;
navBar.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:navBar animated:YES];
[navBar release];
[editWindow release];
navBar
has a UIBarButton
for saveButton. This is called when you press SaveButton
[self dismissModalViewControllerAnimated:YES];
now is the problem:
any idea how to reload the data for both the main NavigationConteroller and the detailViewController when the modalView is dismissed??
I have no clue
thnx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该查看
NSNotificationCenter
。在您的 UITableView 视图中,创建通知侦听器。然后在关闭的视图中调用该通知。更具体地说,通知将调用一个应包含
reloadData
的方法。示例
以下内容应与您要重新加载的 UITableView 一起使用:
这可以与您的
[selfmissModalViewControllerAnimated:YES];
一起使用,这是您调用通知中心来重新加载表格的方式:
示例通知方法:
并且不要忘记删除通知观察者:
You should look into
NSNotificationCenter
. In your view with the UITableView, create the notification listener. Then in the view that dismisses, call that notification.To be more specific, the Notification will call a method that should contain
reloadData
.Example
The following should go with the UITableView you want to reload:
This could go along with your
[self dismissModalViewControllerAnimated:YES];
This is how you will call the notification center to reload the table:
Example of the notification method:
And don't forget to remove the notificaiton observer:
在包含要重新加载的视图的控制器中,您应该拒绝以下方法,该方法将在
modalView
被关闭时(或首次加载控制器的主视图时)被调用:In controllers, that contains view you want to reload, you should decline following method which will be called when the
modalView
will be dismissed (or when controller's main view will be first time loaded):