Does anyone have a short example of how to implement the new UIRefreshControl
into xcode. I have a UITableViewController
which displays Tweets, want to be able to pull down and refresh.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- back button text does not change
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
Here how you do pull Down and Refresh
In your UITableViewController.h add
UIRefreshControl *refreshControl;
and-(void) refreshMyTableView;
method global declarationand in
viewDidLoad
of UITableViewController.mand refresh function with date and time of refresh
You can just set it up in your
viewDidLoad
, if you have aUITableViewController
:Then you can do your refresh stuff here:
When you are done with refreshing, call
[self.refreshControl endRefreshing];
to stop the refresh control, as pointed out by rjgonzo.You can also configure this in Interface Builder. Though the way it currently works, it only saves you a couple of lines of code.
Select the TableViewController scene and in the Attributes Inspector, you'll find a drop down list option for "Refreshing." Set that to "Enabled." You'll notice in the View Controller Hierarchy that a "Refresh Control" has been added (you won't see anything visually added to the scene itself). What's odd is that after hooking up the Refresh Control to an IBAction (Value Change Event) the event doesn't seem to get triggered. I'm guessing that's a bug (?) but meanwhile, setting "Refreshing" to enabled creates the UIRefreshControl object and assigns it to the view controller's refreshControl property. With that done, you can add the event handling line to your viewDidLoad method:
In your refreshView: method, you can do some work and then stop the refresh animation: