iOS 7 UIRefreshControl tintColor not working for beginRefreshing

前端 未结 19 1704
我在风中等你
我在风中等你 2020-12-04 13:48

I\'m trying to set a tintColor on my UIRefreshControl (building on iOS 7). I enabled refreshing for the tableViewController in storyboard, then in my ViewController vi

19条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 14:33

    SWIFT:

    I am using Swift and > iOS8. Most of the described workarounds didn't work for me. That's how I got it working:

    In viewDidLoad:

    customRefreshControl.tintColor = UIColor.clearColor()
    

    The following doesn't have to be inside viewDidLoad. I put it in an extra function which get's called every time I update the tableView:

    private func startRefreshControlAnimation() {
    
        self.tableView.setContentOffset(CGPointMake(0, -self.customRefreshControl.frame.size.height), animated: true)
    
        CATransaction.begin()
        self.customRefreshControl.beginRefreshing()
        CATransaction.commit()
    
    }
    

提交回复
热议问题