Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating table with EGOTableViewPullRefresh

I am using a plist file inorder to fill my table cells , now I added EGOTableViewPullRefresh API to update my cells , but I do not know how can I match my plist url file with this API

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

EDITED :

#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

}
like image 220
iOS.Lover Avatar asked Jun 15 '11 09:06

iOS.Lover


1 Answers

You should just be able to call reloadDataand that will refresh your dataSource. This logic should be the same for a "pull to refresh" feature as well.

like image 68
WrightsCS Avatar answered Oct 14 '22 13:10

WrightsCS