iPhone Pull Down Refresh like Tweetie

前端 未结 5 1538
梦如初夏
梦如初夏 2020-11-30 20:05

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 a

相关标签:
5条回答
  • 2020-11-30 20:28

    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

    0 讨论(0)
  • 2020-11-30 20:37

    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.

    0 讨论(0)
  • 2020-11-30 20:42

    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.

    0 讨论(0)
  • 2020-11-30 20:48

    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!

    0 讨论(0)
  • 2020-11-30 20:49

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

    0 讨论(0)
提交回复
热议问题