刷新控制 - 显示在电视上方

时间:2015-10-14 22:18:47

标签: ios swift uitableview uirefreshcontrol

我想问你如何在电视细胞下展示UIActivityControl。这就是它现在的表现。感谢

(self.tableView.refreshControl = self.refresh_control 不起作用

代码:

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 个答案:

答案 0 :(得分:1)

您不需要refresh_control成员,也不需要将refresh_control添加为子视图。

UITableViewController有一个refreshControl成员。

试试这个:

self.refreshControl = UIRefreshControl()
self.refreshControl.attributedTitle = NSAttributedString(string: "Aktualizace")
self.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)