I have a custom UITableView integrated in my ViewController, with more elements, and I tried to add to the UITableView a control to refresh its content, like twitter app. The problem is that I can’t capture the scrolls of the tableview in the ViewController. If I set the delegate of the custom UITableView, then I can capture the scrolls but I get troubles with the custom table behavior.
So, I don’t know what it’s better, either find the way to add the delegate for scrolls without override anything or find a way to add the control to refresh the table from the ViewController, not from the UITableView class.
The case with more details is:
-
A library for the custom UITableView. It’s used to draw a conversation like the message app. So I just pass the information to the table and the table draw it. I don’t do anything more, not delegate, nothing, just add the table to my ViewController.
-
I put the methods of the scroll’s delegate in my ViewController, and, when I do scroll in the table, I don’t get anything(the app doesn’t enter in the scroll’s delegate methods). If I set the table’s delegate to self, the scroll works but I get some random problems from the table( I don’t know how it’s made the table), so I have to discard this option(set the delegate).
Thanks in advance
Try using the UIRefreshControl object. You define this object in the viewController in the viewDidLoad method and add the target to your tableView when it’s value changes, here is an example:
Your viewController needs to be a UITableViewController however. To initiate and end the refresh use the methods: