2014/07/11

[iOS][Objective-C]UIRefreshControlをUITableViewController使わずに実装する

UITableViewControllerにrefreshControlプロパティーがあってそこに設定すれば、実装できることはわかるのですが、UITableViewControllerを使わずに実装する方法はあるのだろうか?

答えはいけそうだ。
UIRefreshControl:オフィシャル版「引っ張って更新」
を参考にすると、単純に、addSubviewをすればいいようだ。

UITableView *tableView;
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
refreshControl.tintColor = [UIColor redColor];
[tableView addSubView:refreshControl];
確かにできた。

これは便利。

0 コメント:

コメントを投稿