我尝试下拉刷新集合视图,但我使用(tableview 下拉刷新控制器)集合视图的相同代码。请任何人帮助我的问题。
问问题
539 次
1 回答
1
首先,您可以在 viewDidLoad 中编写此代码:-
- (void) viewDidLoad
{
[super viewDidLoad];
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
refreshControl.tintColor = [UIColor blackColor];
refreshControl.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh"];
[refreshControl addTarget:self action:@selector(refreshControlAction) forControlEvents:UIControlEventValueChanged];
[collectionView addSubview:refreshControl];
}
Now add a target
- (void) refreshControlAction
{
// Enter your code for request you are creating here when you pull the collectionView. When the request is completed then the collectionView go to its original position.
}
于 2013-11-09T11:42:59.897 回答