在UITabBarController中切换选项卡后,UIRefreshControl卡住了 [英] UIRefreshControl Stuck After Switching Tabs in UITabBarController

查看:431
本文介绍了在UITabBarController中切换选项卡后,UIRefreshControl卡住了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UITableViewController作为UINavigationController中的根视图控制器,UINavigationController又是UITabBarController中的一个视图控制器。所有这些都连接在Storyboard中。

I have a UITableViewController as the root view controller in a UINavigationController, which is in turn one of the view controllers in a UITabBarController. All hooked up in Storyboard.

我也在故事板中为我的表配置了UIRefreshControl,通常在拉动时看起来应该是这样:

I've configured the UIRefreshControl for my table in Storyboard as well, and normally it looks like it should when pulling:

但是,如果我在其他标签之间切换一次或两次,它看起来像这样:

However, if I switch between my other tabs once or twice, it looks like this:

它没有旋转或任何东西,只是卡住了满,它一直保持这种状态直到我完全拉并触发刷新。

It's not spinning or anything, just stuck "full", and it stays that way until I pull fully and trigger a refresh.

任何想法或建议都表示赞赏。

Any ideas or suggestions appreciate.

推荐答案

我知道这已经太晚了,但是我觉得迟到总比没有好。

I know this is incredibly late, but I figure better late than never.

不幸的是,没有一个给定的答案对我有用。唯一可行的是viewWillAppear中的这段可怕的代码:

Unfortunately, none of the given answers worked for me. The only thing that worked was this awful piece of code in viewWillAppear:

self.refreshControl = nil;
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refreshFunction) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refreshControl;

基本上每次出现视图时我都会重新创建UIRefreshControl。虽然在发出以下警告时它仍然有效:

Basically I recreate the UIRefreshControl every time the view is going to appear. It works, albeit while giving the following warning:


尝试在非空闲时更改刷新控制是强烈劝阻
并且可能无法正常工作。

Attempting to change the refresh control while it is not idle is strongly discouraged and probably won't work properly.

我真的很惊讶这仍然是个问题(现在仍然在iOS 9中看到这个) 。希望这可能对其他人有所帮助。

I'm honestly surprised this is still an issue (still seeing this in iOS 9 now). Hopefully this may be helpful to some other people.

这篇关于在UITabBarController中切换选项卡后,UIRefreshControl卡住了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆