@selector() in Swift?

后端 未结 23 2548
清酒与你
清酒与你 2020-11-21 15:24

I\'m trying to create an NSTimer in Swift but I\'m having some trouble.

NSTimer(timeInterval: 1, target: self, selector: test(), us         


        
23条回答
  •  日久生厌
    2020-11-21 16:03

    Create Refresh control using Selector method.   
        var refreshCntrl : UIRefreshControl!
        refreshCntrl = UIRefreshControl()
        refreshCntrl.tintColor = UIColor.whiteColor()
        refreshCntrl.attributedTitle = NSAttributedString(string: "Please Wait...")
        refreshCntrl.addTarget(self, action:"refreshControlValueChanged", forControlEvents: UIControlEvents.ValueChanged)
        atableView.addSubview(refreshCntrl)
    

    //Refresh Control Method

    func refreshControlValueChanged(){
        atableView.reloadData()
        refreshCntrl.endRefreshing()
    
    }
    

提交回复
热议问题