Pull-to-refresh in UICollectionViewController

The answers to both (1) and (2) are yes. Simply add a UIRefreshControl instance as a subview of .collectionView and it just works. UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; [refreshControl addTarget:self action:@selector(startRefresh:) forControlEvents:UIControlEventValueChanged]; [self.collectionView addSubview:refreshControl]; That’s it! I wish this had been mentioned in the documentation somewhere, even though sometimes a simple experiment does the … Read more

Pull to refresh recyclerview android

You can use android SwipeRefreshLayout widget instead of ProgressDialog. Follow below steps to integrate SwipeRefreshLayout in your Tab1history fragment: 1. In your layout tab1history, add SwipeRefreshLayout as a root layout and place RecyclewrView inside it. // tab1history.xml <?xml version=”1.0″ encoding=”utf-8″?> <android.support.v4.widget.SwipeRefreshLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/swipe_container” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.v7.widget.RecyclerView android:id=”@+id/my_recycler_view” android:layout_width=”match_parent” android:layout_height=”match_parent” /> </android.support.v4.widget.SwipeRefreshLayout> 2. In your Tab1History … Read more

How to disable “pull to refresh” action and use only indicator?

From the documentation: If an activity wishes to show just the progress animation, it should call setRefreshing(true). To disable the gesture and progress animation, call setEnabled(false) on the view. So to show the animation: swiperefreshLayout.setEnabled(true); swiperefreshLayout.setRefreshing(true); And to hide the animation: swiperefreshLayout.setRefreshing(false); swiperefreshLayout.setEnabled(false);

Pull to refresh UITableView without UITableViewController

Add a refresh control directly to a UITableView without using a UITableViewController: override func viewDidLoad() { super.viewDidLoad() let refreshControl = UIRefreshControl() refreshControl.addTarget(self, action: #selector(refresh(_:)), for: .valueChanged) if #available(iOS 10.0, *) { tableView.refreshControl = refreshControl } else { tableView.backgroundView = refreshControl } } @objc func refresh(_ refreshControl: UIRefreshControl) { // Do your job, when done: refreshControl.endRefreshing() … Read more

How to implement Android Pull-to-Refresh

Finally, Google released an official version of the pull-to-refresh library! It is called SwipeRefreshLayout, inside the support library, and the documentation is here: Add SwipeRefreshLayout as a parent of view which will be treated as a pull to refresh the layout. (I took ListView as an example, it can be any View like LinearLayout, ScrollView … Read more