我正在使用UITableView控件来显示一些可以由用户编辑的数据。为了编辑细节,用户点击编辑按钮,将新视图推入堆栈。用户编辑数据,点击保存按钮,数据被保存到plist中,视图弹出堆栈。即使plist已更新,UITableView仍会显示旧数据。这可以通过在viewWillAppear方法中添加对reloadData的调用来解决。但是,当视图第一次加载数据显示正确,通过添加重载语句这是否意味着双重绑定?如果是这样,这怎么能避免?UITableView刷新查询
我发现下面的代码(here),它强制进行刷新,而不显式调用reloadData:
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
int orientation = [[UIDevice currentDevice] orientation];
if(orientation != UIDeviceOrientationUnknown)
[self willRotateToInterfaceOrientation:orientation duration:0];
}
谁能解释如何/为什么这样的作品?