Why UIRefreshControl jumping?

前端 未结 4 1982
花落未央
花落未央 2020-12-18 01:35

I try to use the UIRefreshControl with swift 1.2 and works fine except the UI. It is jumping and I dont know why. Here is what I am doing:

class ViewControll         


        
4条回答
  •  Happy的楠姐
    2020-12-18 01:45

    I found a solution, it works:

    override func viewDidLoad() {
        super.viewDidLoad()
    
        self.refreshControl = UIRefreshControl()
        self.refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh")
        self.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
    
    
        var tableViewC = UITableViewController()
        tableViewC.refreshControl = self.refreshControl
    
        self.tableView = tableViewC.tableView
    
        self.view.addSubview(self.tableView)
    }
    

提交回复
热议问题