Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using UIRefreshControl in UIViewController with UITableView

Tags:

xcode

ios

swift

I wonder how i can use UIRefreshController for a UITableView inside a UIViewController.

I want to implement pull-to-refresh functionality to TableView but i don't have a TableViewController.

Is there a way to do this in xcode 6 (swift)

like image 333
Utku Dalmaz Avatar asked Mar 25 '26 01:03

Utku Dalmaz


1 Answers

Of course you can do this. Initiate a RefreshControl and simply put it as subview of your tableview. You don't necessarily need a UITableViewController for this.

EDIT:

Try something like this:

let control = UIRefreshControl()
control.addTarget(self, action: "action", forControlEvents: .ValueChanged)
tableView.addSubview(control)
like image 163
croX Avatar answered Mar 26 '26 16:03

croX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!