Iphone 如何在登录视图之后刷新/更新tableview?

Iphone 如何在登录视图之后刷新/更新tableview?,iphone,uitableview,Iphone,Uitableview,我有一个表视图,它位于项目的导航视图中。 我为登录过程推送另一个视图。 此视图接受密码并将其发送到服务器进行验证。 如果密码正确,服务器将返回一些XML格式的数据 我想用这个XML数据刷新表视图。 之前,在将navigationController视图添加到窗口之前,我首先解析了xml 从超级表视图中删除登录视图后,如何刷新表视图 感谢(无效)控制器将更改内容:(NSFetchedResultsController*)控制器{ [self.table1View开始更新]; } - (vo

我有一个表视图,它位于项目的导航视图中。 我为登录过程推送另一个视图。 此视图接受密码并将其发送到服务器进行验证。 如果密码正确,服务器将返回一些XML格式的数据

我想用这个XML数据刷新表视图。 之前,在将navigationController视图添加到窗口之前,我首先解析了xml

从超级表视图中删除登录视图后,如何刷新表视图

感谢

(无效)控制器将更改内容:(NSFetchedResultsController*)控制器{ [self.table1View开始更新]; }

    - (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo
               atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type {

        switch(type) {
            case NSFetchedResultsChangeInsert:
                [self.table1View insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
                break;

            case NSFetchedResultsChangeDelete:
                [self.table1View deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
                break;
        }
    }


    - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
           atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
          newIndexPath:(NSIndexPath *)newIndexPath {

        UITableView *tableView = self.table1View;

        switch(type) {

            case NSFetchedResultsChangeInsert:
                [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
                break;

            case NSFetchedResultsChangeDelete:
                [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
                break;

            case NSFetchedResultsChangeUpdate:
                [self configureCell:[tableView cellForRowAtIndexPath:indexPath] atIndexPath:indexPath];
                break;

            case NSFetchedResultsChangeMove:
                [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
                [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath]withRowAnimation:UITableViewRowAnimationFade];
                break;
        }
    }
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
    [self.table1View beginUpdates];
}
-(void)控制器:(NSFetchedResultsController*)控制器didChangeSection:(id)sectionInfo
atIndex:(nsInteger)ChangeType:(NSFetchedResultsChangeType)类型的节索引{
开关(类型){
案例NSFetchedResultsChangesInsert:
[self.table1View insertSections:[NSIndexSet IndexSetWithiIndex:sectionIndex]带RowAnimation:UITableViewRowAnimationFade];
打破
案例NSFetchedResultsChangeDelete:
[self.table1View deleteSections:[NSIndexSet IndexetWithiIndex:sectionIndex]带RowAnimation:UITableViewRowAnimationFade];
打破
}
}
-(void)控制器:(NSFetchedResultsController*)控制器didChangeObject:(id)一个对象
atIndexPath:(NSIndexPath*)indexPath forChangeType:(NSFetchedResultsChangeType)类型
newindepath:(nsindepath*)newindepath{
UITableView*tableView=self.table1View;
开关(类型){
案例NSFetchedResultsChangesInsert:
[tableView InsertRowsatindExpath:[NSArray arrayWithObject:newIndexPath]带RowAnimation:UITableViewRowAnimationFade];
打破
案例NSFetchedResultsChangeDelete:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]和RowAnimation:UITableViewRowAnimationFade];
打破
案例NSFetchedResultsChangeUpdate:
[self-configureCell:[tableView cellForRowAtIndexPath:indexPath]atIndexPath:indexPath];
打破
案例NSFetchedResultsChangeMove:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]和RowAnimation:UITableViewRowAnimationFade];
[tableView InsertRowsatindExpath:[NSArray arrayWithObject:newIndexPath]带RowAnimation:UITableViewRowAnimationFade];
打破
}
}
-(void)controllerWillChangeContent:(NSFetchedResultsController*)控制器{
[self.table1View开始更新];
}
如果你有这个功能,你可以使用
[self.YourTableView-reloadData]

希望对您有所帮助

(void)controllerWillChangeContent:(NSFetchedResultsController*)controller{ [self.table1View开始更新]; }

    - (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo
               atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type {

        switch(type) {
            case NSFetchedResultsChangeInsert:
                [self.table1View insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
                break;

            case NSFetchedResultsChangeDelete:
                [self.table1View deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
                break;
        }
    }


    - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
           atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
          newIndexPath:(NSIndexPath *)newIndexPath {

        UITableView *tableView = self.table1View;

        switch(type) {

            case NSFetchedResultsChangeInsert:
                [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
                break;

            case NSFetchedResultsChangeDelete:
                [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
                break;

            case NSFetchedResultsChangeUpdate:
                [self configureCell:[tableView cellForRowAtIndexPath:indexPath] atIndexPath:indexPath];
                break;

            case NSFetchedResultsChangeMove:
                [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
                [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath]withRowAnimation:UITableViewRowAnimationFade];
                break;
        }
    }
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
    [self.table1View beginUpdates];
}
-(void)控制器:(NSFetchedResultsController*)控制器didChangeSection:(id)sectionInfo
atIndex:(nsInteger)ChangeType:(NSFetchedResultsChangeType)类型的节索引{
开关(类型){
案例NSFetchedResultsChangesInsert:
[self.table1View insertSections:[NSIndexSet IndexSetWithiIndex:sectionIndex]带RowAnimation:UITableViewRowAnimationFade];
打破
案例NSFetchedResultsChangeDelete:
[self.table1View deleteSections:[NSIndexSet IndexetWithiIndex:sectionIndex]带RowAnimation:UITableViewRowAnimationFade];
打破
}
}
-(void)控制器:(NSFetchedResultsController*)控制器didChangeObject:(id)一个对象
atIndexPath:(NSIndexPath*)indexPath forChangeType:(NSFetchedResultsChangeType)类型
newindepath:(nsindepath*)newindepath{
UITableView*tableView=self.table1View;
开关(类型){
案例NSFetchedResultsChangesInsert:
[tableView InsertRowsatindExpath:[NSArray arrayWithObject:newIndexPath]带RowAnimation:UITableViewRowAnimationFade];
打破
案例NSFetchedResultsChangeDelete:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]和RowAnimation:UITableViewRowAnimationFade];
打破
案例NSFetchedResultsChangeUpdate:
[self-configureCell:[tableView cellForRowAtIndexPath:indexPath]atIndexPath:indexPath];
打破
案例NSFetchedResultsChangeMove:
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]和RowAnimation:UITableViewRowAnimationFade];
[tableView InsertRowsatindExpath:[NSArray arrayWithObject:newIndexPath]带RowAnimation:UITableViewRowAnimationFade];
打破
}
}
-(void)controllerWillChangeContent:(NSFetchedResultsController*)控制器{
[self.table1View开始更新];
}
如果你有这个功能,你可以使用
[self.YourTableView-reloadData]


希望它有助于

将在将navigationController视图添加到窗口之前完成的所有代码添加到ViewWillAspect方法中,创建一个方法并从两个位置调用它。

将在将navigationController视图添加到窗口之前完成的所有代码添加到ViewWillAspect方法中,创建一个方法并从两个位置调用它。

对于刷新表视图,您可以使用

[table reloadData];.

对于刷新表视图,可以使用

[table reloadData];.

我使用以下代码。但我得到了“tableView”未声明的错误。我没有声明tableView。我的主窗口从另一个nib文件加载表视图。有什么想法吗-(void)视图将出现:(BOOL)动画{[super-viewwillbeep:animated];[tableView-reloadData];}在IB中声明您的tableView;并将其映射并将委托方法连接到FileOwner