【发布时间】:2015-03-05 19:44:07
【问题描述】:
我正在尝试在 UICollectionView 上的项目中实现 UIRefreshControl。它按预期工作,但我需要将UICollectionView 拉动大约是refreshControl 旋转时高度的3 倍(一旦用户松开)。我见过其他应用程序,您只需在 refreshControl 旋转时下拉到它的高度。如何更改我需要下拉的金额?
代码:
(void)viewDidLoad {
[super viewDidLoad];
[self.collectionView setBackgroundColor:[UIColor clearColor]];
self.refreshControl = [UIRefreshControl new];
[self.refreshControl addTarget:self action:@selector(refreshFavorites) forControlEvents:UIControlEventValueChanged];
[self.collectionView addSubview:self.refreshControl];
self.collectionView.alwaysBounceVertical = YES;
}
附上图片以帮助形象化我的意思。我的collectionView 有一排(纯红色)。红色和refreshControl 之间的空间只是我拉下以尝试激活refreshControl 的空间。
在这张图片中,我几乎激活了控件,并且已经在屏幕上拉下了相当多的内容。
在这张图片中,我激活了控件,它开始加载(在它跳跃 ~20-30 pix 之后,但它仍然突出了它的重要性)
此图像显示控件在被激活并正在执行动画后处于“静止”状态。
我尝试设置UIRefreshControl 的框架来尝试控制高度,但这不起作用。我还更改了 collectionView:layout:sizeForItemAtIndexPath 的大小,但没有帮助。
【问题讨论】:
-
你最终解决了这个问题吗?有同样的问题。
标签: ios