UICollectionView UIRefreshControl 在访问不同的视图后没有动画 [英] UICollectionView UIRefreshControl Doesn't Animate After Visiting a Different View
问题描述
我有一个 UIRefreshControl 连接到一个以这种方式定义的 UICollection 用于拉刷新:
I have a UIRefreshControl connected to a UICollection that is defined this way for pull to refresh:
self.refreshControl = [[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self action:@selector(startRefresh:)
self.collectionView.alwaysBounceVertical = YES;
[self.collectionView addSubview:self.refreshControl];
这很好用.但是,每当我通过推送新视图控制器或显示滑动侧边栏菜单移动到新视图并返回到该视图时,刷新控件开始显示一直拉动的控件的图像(即它没有动画并显示完整的圆圈).但是,如果我完全下拉并释放,刷新控件将恢复正常功能.该控件工作正常,只是在您导航到别处后第一次拉动时看起来很时髦.
This works fine. However, whenever I move to a new view by either pushing a new view controller or displaying the sliding sidebar menu, and return to this view, the refresh control starts displaying the image for a control pulled all the way (i.e. it doesn't animate and shows the full circle). However, if I pull down fully and release, the refresh control returns to normal functionality. The control works fine, it just looks funky the first time you pull after navigating elsewhere.
我希望能就可能出现的问题提供任何反馈.谢谢!
I would love any feedback on what might be going wrong. Thanks!
这是图片不工作时的样子(注意我链接到一个在线图片,这不是来自我的应用程序,所以这并不表明 collectionview 正在被拉下):
This is what the image looks like when not working (note I am linking to an online image, this is not from my app so this doesn't show that the collectionview is being pulled down):
下面发布的解决方案有效,但我必须做一些额外的工作才能确定我的顶视图控制器何时从我正在使用的侧边栏菜单(ECSlidingViewController)中获得焦点:ECSlidingViewController 中的顶视图控制器是否有办法知道侧边栏何时出现菜单已关闭?
Posted solution below worked, but I had to do some extra work to figure out when my top view controller received focus from the sidebar menu that I was using (ECSlidingViewController): Is there a way for the Top View Controller in ECSlidingViewController to know when the sidebar menu has been dismissed?
推荐答案
加载完成后必须停止刷新
After completed loading You have to stop the refreshing
[tableView.refreshControl endRefreshing]
希望它对你有用..:)
Hope its useful for you..:)
这篇关于UICollectionView UIRefreshControl 在访问不同的视图后没有动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!