samedi 23 juillet 2016

Must I call UIActivityIndicatorView.stopAnimating before UIView.removeFromSuperview?

Do I need (or is it good practice) to call stopAnimating() before I remove a UIActivityIndicatorView from its superview? If so, why? If not, why not?

Related:

Example:

override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    if refreshing {
        if tableView.backgroundView == nil {
            let activityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: .Gray)
            activityIndicatorView.startAnimating()
            tableView.backgroundView = activityIndicatorView
        }
        return 0
    }
    // Should I stop animating the activityIndicatorView here?
    tableView.backgroundView = nil
    return 2
}

Aucun commentaire:

Enregistrer un commentaire