Thursday, October 28, 2010

EGOTableViewPullRefresh for multiple UITableViews

Wanted to add a "Pull To Refresh" feature similar to Tweetie2, so i looked around to see if there was any reusable code (screenshot from Zattr).

Cocoanetics (ex-Dr. Touch) has a good article explaining"pull to refresh" internal workings, well worth investing the time and effort to read. Recommended! However he's solution was not reusable for me, since I don't have UITableViewController. Fortunately he referenced Enormego's solution using UITableViews, including a walk-through with changes.

Btw if you have several lists, which each need to have different state texts, try this method to add optional list specific state messages:

NSArray *stateText;
@property (nonatomic, copy) NSArray *stateText;
case EGOOPullRefreshPulling:
    if (self.stateText)
        statusLabel.text = [self.stateText objectAtIndex:0];
        statusLabel.text = @"Release to refresh...";
- (void)dealloc
    [stateText release]; stateText = nil;
refreshHeaderView.stateText = [NSArray arrayWithObjects: @"Release...", @"Pull...", @"Load...", nil];
EGOTableViewPullRefresh is fourth "pull to refresh" sample project I'm checking, required several small changes and heavy integration to fit the purpose (five lists of three different types). Not sure, if I'll take this into use, but so far it's the one that actually worked.

No comments:

Post a Comment