Bonjour im ayant ce doute puis-je mettre fin à un contrôle de rafraîchissement dans une autre classe? Dans mon tableviewcontroller j'ai ceci:Comment puis-je terminer rafraîchir dans une autre classe rapide?
func setRefreshGesture() {
let refreshGesture = UIRefreshControl()
refreshGesture.backgroundColor = UIColor.clearColor()
refreshGesture.tintColor = UIColor.whiteColor()
refreshGesture.addTarget(WorkUpdater.sharedInstance,action:#selector(WorkUpdater.attemptUpdateControl),forControlEvents:.ValueChanged)
self.refreshControl = refreshGesture
self.refreshControl?.layer.zPosition = self.tableView.backgroundView!.layer.zPosition + 1
}
et dans mon autre classe .. ont ceci:
func attemptUpdateControl(){
if !isUpdating && canPerformUpdate() {
isUpdating = true
performUpdateControl()
} else {
print("ERROR: - Update in progress")
}
}
func performUpdateControl(){
let reach = Reachability.reachabilityForInternetConnection()!
if reach.isReachable() {
work.getData()
} else {
UIAlertView(title: "Device without connection", message: "You must have an internet connection to use this feature", delegate: nil, cancelButtonTitle: "OK").show()
// ici je veux terminer mon rafraîchissement de tableviewcontroller
}
}