UIRefreshControl iOS 6 xcode [英] UIRefreshControl iOS 6 xcode

查看:104
本文介绍了UIRefreshControl iOS 6 xcode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人举例说明如何在xcode中实现新的 UIRefreshControl 。我有一个显示推文的 UITableViewController ,希望能够下拉并刷新。

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.

推荐答案

你可以在你的 viewDidLoad 中设置它,如果你有一个 UITableViewController

You can just set it up in your viewDidLoad, if you have a UITableViewController:

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refresh)
         forControlEvents:UIControlEventValueChanged]; 
self.refreshControl = refreshControl;

然后你可以在这里刷新东西:

Then you can do your refresh stuff here:

-(void)refresh {
    // do something here to refresh.
}

完成刷新后,请致电 [self .refreshControl endRefreshing]; 停止刷新控制,正如rjgonzo所指出的那样。

When you are done with refreshing, call [self.refreshControl endRefreshing]; to stop the refresh control, as pointed out by rjgonzo.

这篇关于UIRefreshControl iOS 6 xcode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆