Pull to Refresh (ios)

前端 未结 8 1039
清酒与你
清酒与你 2020-12-07 22:08

I recently implemented pull to refresh here: https://github.com/leah/PullToRefresh. It kind of works however it gets stuck with a spinning activity indicator. Their is also

相关标签:
8条回答
  • 2020-12-07 22:27

    Without code there's not much anyone can say, but maybe try a different implementation of Pull To Refresh, like the enormego (EGO) version, the code is at github, here

    It's used in the Facebook app so it definitely works.

    0 讨论(0)
  • 2020-12-07 22:31

    I found this library very useful, fancy and up-to-date: https://github.com/Yalantis/Pull-to-Refresh.Rentals-iOS

    (Recommendations from other answers seem old and not maintained)

    0 讨论(0)
  • 2020-12-07 22:40

    I am new to iOS development and I was trying to implement the pull to refresh in iOS 6. Well looking for a solution, I stumbled across this blog post and found it to be very helpful, http://www.intertech.com/Blog/Post/iOS-6-Pull-to-Refresh-(UIRefreshControl).aspx. It lays out the steps to implementing pull to refresh in a way that is easy to follow. Anyone looking to do this themselves in iOS 6 should check out the blog.

    The UIRefreshControl is only useable with a Table View currently. There are a few steps to follow to successfully add a refresh control:

    1. Create a callback method to handle your refresh logic. The callback method should be invoked when a user pulls down on the table view. The signarture of the method should take one parameter: a pointer to the UIRefreshControl.

    Note: Steps 2-4 are all done within the Table View Controller’s viewDidLoad method.

    2. Instantiate the UIRefreshControl with a basic "alloc/init".

    3. Connect an action to the refresh control to invoke your callback method when the ValueChange event is fired.

    4. Add the refresh control to the Table View Controller's "refreshControl" property.

    0 讨论(0)
  • 2020-12-07 22:43

    You can use : https://github.com/ngocbinh02/httablekit

    Support iOS 5.0 or later

    Pull to refresh tableview

        import <HTTableKit/TableKit>
    
    ....
    
    //like UIRefreshControll
    
    [tableview setPullToRefreshControlType:UITableViewRefreshControlTypeSystem]; 
    
    [tableview  setPullToRefreshModeEnable:YES beginHandler:^{
    
          // to do here when pulling to refresh
    }];
    

    Dismiss pull to refresh tableview

        import <HTTableKit/TableKit>
    
    ....
    
    [tableview  dismissPullToRefreshEndHandler:^{
    
          // to do here when dismissing     
    }];
    
    0 讨论(0)
  • 2020-12-07 22:45

    I prefer the EGO implementation than the leah one because it does not require a subclass of your view controller. The original EGO one in github is a bit of a mess with no .gitnore file and lots of .DS_Store files added unnecessarily. Take a look at some of the many forks and pick one.

    The "emreberge" fork looks like a good version, better file organisation and documentation too!

    https://github.com/emreberge/EGOTableViewPullRefresh

    0 讨论(0)
  • 2020-12-07 22:49

    Here's our tutorial on Custom Pull-to-Refresh controls, with code for Objective-C and Swift: http://www.jackrabbitmobile.com/design/ios-custom-pull-to-refresh-control/

    To add additional text or images, as you mentioned, add them into self.refreshLoadingView in the setupRefreshControl or scrollViewDidScroll methods (from the tutorial).

    Let me know if that helps!

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