Ios 控制闪烁
我在iOS 8下实现UIRefreshControl时遇到了一种闪烁。每次我第一次来到tableView的顶部,意思是当应用程序刚刚启动时,我都会看到下面的gif中显示的闪烁。这不会发生在以后的任何时候,我来到tableView的顶部,直到再次加载此视图,所以在我在应用程序的另一个视图中做了一些事情或完全重新启动它之后 这是我的应用程序的viewDidLoad中的代码:Ios 控制闪烁,ios,uitableview,uirefreshcontrol,Ios,Uitableview,Uirefreshcontrol,我在iOS 8下实现UIRefreshControl时遇到了一种闪烁。每次我第一次来到tableView的顶部,意思是当应用程序刚刚启动时,我都会看到下面的gif中显示的闪烁。这不会发生在以后的任何时候,我来到tableView的顶部,直到再次加载此视图,所以在我在应用程序的另一个视图中做了一些事情或完全重新启动它之后 这是我的应用程序的viewDidLoad中的代码: let refreshControl = UIRefreshControl() override func viewDidL
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函数中调用EndRefresh方法。这似乎是一种显而易见的方法。我可以通过更改以下行来解决这个问题
tableView.addSubview(refreshControl)
到
多亏了这句话:我可以通过更改以下行来解决这个问题
tableView.addSubview(refreshControl)
到
感谢此评论:将UIRefreshControl父视图的背景色更改为与UIRefreshControl的背景色相同 比如:
refreshControl.Superview.BackgroundColor=refreshControl.BackgroundColor将UIRefreshControl父视图的背景色更改为与UIRefreshControl的背景色相同 比如:
refreshControl.Superview.BackgroundColor=refreshControl.BackgroundColor即使这样,refreshControl显示在启动ios 11的表格上方。x ios 9工作正常即使这样,refreshControl显示在启动ios 11的表格上方。x ios 9工作正常