Refresh Control - showing above TV

2019-08-19 20:04发布

I'd like to ask you how can I show UIActivityControl under TV cells. This is how it's showed right now. Thanks

(self.tableView.refreshControl = self.refresh_control doesn't work)

Code:

override func viewDidLoad() {
    super.viewDidLoad()

    self.refresh_control = UIRefreshControl()
    self.refresh_control.attributedTitle = NSAttributedString(string: "Aktualizace")
    self.refresh_control.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
    self.view.addSubview(self.refresh_control)
    self.view.bringSubviewToFront(self.tableView)
}

enter image description here

1条回答
你好瞎i
2楼-- · 2019-08-19 20:38

You don't need the refresh_control member, nor do you need to add refresh_control as a subView.

UITableViewController has a refreshControl member.

Try this:

self.refreshControl = UIRefreshControl()
self.refreshControl.attributedTitle = NSAttributedString(string: "Aktualizace")
self.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
查看更多
登录 后发表回答