我在iOS 8下实现UIRefreshControl时遇到了一种闪动。每次我第一次来到我的tableView顶部(即应用程序刚刚启动时),我都会看到下面的gif中所示的闪动。这不会在随后的任何时候我到达tableView的顶部,直到这个视图再次加载,所以当我在应用程序的另一个视图中做了一些事情或完全重新启动它之后。

下面是我的应用程序的viewDidLoad()中的代码:
let refreshControl = UIRefreshControl()
override func viewDidLoad() {
super.viewDidLoad()
// Doing this here to prevent the UIRefreshControl sometimes looking messed up when waking the app
self.refreshControl.endRefreshing()
updateData()
refreshControl.backgroundColor = UIColor(hue: 0.58, saturation: 1.0, brightness: 0.43, alpha: 1.0)
refreshControl.tintColor = UIColor.whiteColor()
refreshControl.addTarget(self, action: "updateData", forControlEvents: UIControlEvents.ValueChanged)
tableView.addSubview(refreshControl)
}refreshControl是在viewDidLoad()函数外部声明的,因为我想从updateData()函数内部调用endRefreshing方法。这似乎是一种显而易见的方式。
发布于 2015-03-17 06:55:28
我可以通过修改下面的代码行来解决这个问题
tableView.addSubview(refreshControl)至
tableView.insertSubview(refreshControl, atIndex: 0)发布于 2015-09-30 12:13:01
将as刷新控件的父视图的背景色更改为与UIRefreshControl的背景色相同。
类似于:
refreshControl.Superview.BackgroundColor = refreshControl.BackgroundColor
https://stackoverflow.com/questions/29085003
复制相似问题