你可以在这里看到: UIViewController 中的 UIRefreshControl (with UITableView)
@interface MyViewController ()
{
UIRefreshControl *refreshControl;
}
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@end
@implementation MyViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UIView *refreshView = [[UIView alloc] initWithFrame:CGRectMake(0, 55, 0, 0)];
[self.tableView insertSubview:refreshView atIndex:0]; //the tableView is a IBOutlet
refreshControl = [[UIRefreshControl alloc] init];
refreshControl.tintColor = [UIColor redColor];
[refreshControl addTarget:self action:@selector(reloadDatas) forControlEvents:UIControlEventValueChanged];
/* NSMutableAttributedString *refreshString = [[NSMutableAttributedString alloc] initWithString:@"Pull To Refresh"];
[refreshString addAttributes:@{NSForegroundColorAttributeName : [UIColor grayColor]} range:NSMakeRange(0, refreshString.length)];
refreshControl.attributedTitle = refreshString; */
[refreshView addSubview:refreshControl];
}
-(void)reloadDatas
{
//update here...
[refreshControl endRefreshing];
}
@end
http://www.g8production.com/post/79514553078/ios7-and-uirefreshcontrol-in-uiviewcontroller-with