var refreshControl:UIRefreshControl! // An optional variable
func viewDidLoad()
{
super.viewDidLoad()
self.refreshControl = UIRefreshControl()
self.refreshControl.attributedTitle = NSAttributedString(string: "Pull to refersh")
self.refreshControl.addTarget(self, action: "refresh:", forControlEvents:
UIControlEvents.ValueChanged)
self.tableView.addSubview(refreshControl)
}
func refresh(sender:AnyObject)
{
// Code to refresh table view
}
At some point you could end refreshing.
self.refreshControl.endRefreshing()
No comments:
Post a Comment