How do I “hide” a UIRefreshControl?

前端 未结 12 953
醉梦人生
醉梦人生 2020-12-15 16:16

Occasionally my table view won\'t be connected to a service to refresh, and in that case, I don\'t want the UIRefreshControl to be present.

After I add it in viewDid

12条回答
  •  [愿得一人]
    2020-12-15 17:03

    I had bad experience when set tableView.refreshConrol = nil , because when I set it back to old refreshControl, it started animation only in a second, so it looked not good, so when I need to disable refreshControl I use:

    tableView.refreshControl?.endRefreshing()
    tableView.refreshControl?.alpha = 0
    

    when I need it back I use:

    tableView.refreshControl?.alpha = 1
    // and if I need to show refreshing indicator immediately I write:
    tableView.refreshControl?.beginRefreshing()
    

    P.S. Setting isHidden, isEnabled, isUserInteractionEnabled didn't help

提交回复
热议问题