ios - UICollectionView UIRefreshControl 在访问不同的 View 后不会动画

标签 ios uicollectionview uirefreshcontrol

我有一个连接到 UICollection 的 UIRefreshControl,该 UICollection 是这样定义的,用于拉动刷新:

    self.refreshControl = [[UIRefreshControl alloc] init];
    [self.refreshControl addTarget:self action:@selector(startRefresh:)
    self.collectionView.alwaysBounceVertical = YES;
    [self.collectionView addSubview:self.refreshControl];

这很好用。但是,每当我通过插入新 View Controller 或显示滑动侧边栏菜单移动到新 View 并返回到此 View 时,刷新控件就会开始显示一直拉出的控件的图像(即,它不会设置动画)并显示完整的圆圈)。但是,如果我完全下拉并释放,刷新控件将恢复正常功能。该控件工作正常,只是在导航到其他地方后第一次拉动时看起来很时髦。

我希望收到有关可能出现问题的任何反馈。谢谢!

这是图像不工作时的样子(请注意,我链接到在线图像,这不是来 self 的应用程序,因此这不会显示 CollectionView 正在被下拉):

demonstrative image

下面发布的解决方案有效,但我必须做一些额外的工作来弄清楚我的顶 View Controller 何时从我正在使用的侧边栏菜单接收焦点(ECSlidingViewController):Is there a way for the Top View Controller in ECSlidingViewController to know when the sidebar menu has been dismissed?

最佳答案

加载完成后必须停止刷新

[tableView.refreshControl endRefreshing]

希望它对你有用......:)

关于ios - UICollectionView UIRefreshControl 在访问不同的 View 后不会动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26007968/

相关文章:

iPhone 拉动以刷新移动图标位置

ios - SKPhysicsJointSpring 在两个不是场景直接子对象的对象之间

ios - 有时未收到推送通知

ios - 与 SDWebImage 一起使用时,UICollectionViewCell 保持黑色

ios - 自定义 UICollectionViewLayout 和 float 补充标题 View 崩溃

ios - Swift 从父 View 中删除 subview

ios - 快速拉动刷新

iphone - ARC 循环保留检测

ios - 应用程序为 "waiting for review"时的试飞

ios - 具有自定义流布局的 CollectionView 不会触发 didSelectItemAt