iPhone Pull Down Refresh like Tweetie

吃可爱长大的小学妹 提交于 2019-11-26 11:55:58

问题


I am trying to find an example of placing an element above the Table View outside the normal scrollable region. How would I do this? An example would be what the Tweetie 2 app for the iPhone does to refresh tweets.

Sample code would be extremely helpful.


回答1:


I did find the answer to my own question, for anyone who is interested.

EGOTableViewPullRefresh

I tried this solution and it works great! It is almost identical to the Tweetie Pull Down refresh.




回答2:


Here's an alternative to EGOTableViewPullRefresh:

http://blog.leahculver.com/2010/12/iphone-pull-to-refresh.html

Source available on github here:

https://github.com/leah/PullToRefresh

It's slightly easier to use from the developers point of view, though I did go with EGOTableViewPullRefresh in the end as I preferred how it looked.




回答3:


Start with iOS 6.0, there is a standard control called UIRefreshControl within sdk. apple doc here




回答4:


Here what you can do with iOS 6 and later:

- (void)viewDidLoad { 
    // other initialization
    self.refreshControl = [[UIRefreshControl alloc] init];
    [self.refreshControl addTarget:self
                            action:@selector(myRefresh)
                  forControlEvents:UIControlEventValueChanged];
}

Your refresh method:

- (void)myRefresh {  
    // get refreshed data for table view
}  

You end refreshing in reloadData:

- (void)reloadData {  
    [self.tableView reloadData];  

    // End the refreshing   
    if (self.refreshControl) {  
        [self.refreshControl endRefreshing];  
    }  
}    

Then you are all set!




回答5:


You are looking for UIRefreshControl which is available for every UITableViewController - https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIRefreshControl_class/Reference/Reference.html



来源:https://stackoverflow.com/questions/1634739/iphone-pull-down-refresh-like-tweetie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!