Objective c 分区UITableView刷新
在我的应用程序中,是popover中的UITableView,它会在新数据出现时重新加载。如果表格未分段,则所有工作均符合此代码: 启动重新加载的通知:Objective c 分区UITableView刷新,objective-c,ios,cocoa-touch,uitableview,Objective C,Ios,Cocoa Touch,Uitableview,在我的应用程序中,是popover中的UITableView,它会在新数据出现时重新加载。如果表格未分段,则所有工作均符合此代码: 启动重新加载的通知: - (void)recieveNotification:(NSNotification*) notification { if ([[notification name] isEqualToString:@"NewDataArrived"]) { [self viewWillAppear:YES]; } 重新加载的方法: - (voi
- (void)recieveNotification:(NSNotification*) notification {
if ([[notification name] isEqualToString:@"NewDataArrived"]) {
[self viewWillAppear:YES];
}
重新加载的方法:
- (void)viewWillAppear:(BOOL)animated
{
//Formation of the new content of table
[self.tableView reloadData];
[super viewWillAppear:animated];
}
但如果我按节对内容进行排序,一切都会变得混乱。视图不重新加载,新数据只添加到表的末尾,最后一节
章节标题:
- (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
if (section == 0) {
return @"Cities";
} else
if (section == 1) {
return @"Hotels";
} else
if (section == 2) {
return @"Airports";
} else
return @"Landmarks";
}
我在这个问题上花了很多时间,如果有任何建议,我将不胜感激。喜欢这个朋友
h
m
-(void)myOwnMethod:(id)sender;
-(void)myOwnMethod:(id)sender{
[self.tableView reloadData];
}
- (void)recieveNotification:(NSNotification*) notification {
if ([[notification name] isEqualToString:@"NewDataArrived"]) {
// [self viewWillAppear:YES];
[self myOwnMethod];
}
}