uitableview - 使用EGOTableViewPullRefresh更新表

标签 uitableview ios4

我正在使用plist文件填充表格单元格,现在我添加了EGOTableViewPullRefresh API来更新单元格,但是我不知道如何将我的plist url文件与此API相匹配

//this is my plist code that load from server 
     NSURL *url = [NSURL URLWithString:@"http://example.com/news.plist"];
     titles = [[NSArray arrayWithContentsOfURL:url] retain];

编辑:
#pragma mark -
#pragma mark Data Source Loading / Reloading Methods

- (void)reloadTableViewDataSource{

    //  should be calling your tableviews data source model to reload
    //  put here just for demo
    _reloading = YES;
    [self.tableView reloadData];  

}

- (void)doneLoadingTableViewData{

    //  model should call this when its done loading
    _reloading = NO;
    [_refreshHeaderView egoRefreshScrollViewDataSourceDidFinishedLoading:self.tableView];

}


#pragma mark -
#pragma mark UIScrollViewDelegate Methods

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ 

    [_refreshHeaderView egoRefreshScrollViewDidScroll:scrollView];

}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{

    [_refreshHeaderView egoRefreshScrollViewDidEndDragging:scrollView];

}


#pragma mark -
#pragma mark EGORefreshTableHeaderDelegate Methods

- (void)egoRefreshTableHeaderDidTriggerRefresh:(EGORefreshTableHeaderView*)view{

    [self reloadTableViewDataSource];
    [self performSelector:@selector(doneLoadingTableViewData) withObject:nil afterDelay:3.0];

}

- (BOOL)egoRefreshTableHeaderDataSourceIsLoading:(EGORefreshTableHeaderView*)view{

    return _reloading; // should return if data source model is reloading

}

- (NSDate*)egoRefreshTableHeaderDataSourceLastUpdated:(EGORefreshTableHeaderView*)view{

    return [NSDate date]; // should return date data source was last changed

}

最佳答案

您应该只能够调用reloadData,这将刷新dataSource。对于“拉动刷新”功能,此逻辑也应该相同。

关于uitableview - 使用EGOTableViewPullRefresh更新表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6355918/

相关文章:

ios - 更改 UITableViewCell 的高度,无需 heightForRowAtIndexPath

uitableview - UITableViewCells 的不同 - 重复模式

iphone - 如何格式化 NSDate?

iOS 4 : Is it possible to show Local Notifications during a Telephony Call?

iphone - 上载不同的iPhone/iPad应用程序版本

iphone - 如何平滑滚动以查看 iOS 中 tableview 中的所有项目

ios - 在 Swift 中禁用动态类型

ios - 透明的 UITableViewHeaderFooterView

iphone - 如何构建用于在 iPhone 中标记电子邮件的应用程序?

iphone - 可以将下载的 mp3 从应用程序移动到 iPod 吗?