How to show activity indicator while tableView loads?

前端 未结 12 1544
说谎
说谎 2021-01-30 21:44

When I switch between my tabs it loads some seconds and I want to know that my data is loading. For that I decided to add an activity indicator.

I wrote a little functio

12条回答
  •  北恋
    北恋 (楼主)
    2021-01-30 21:58

    This code can help you :)

       let indicator:UIActivityIndicatorView = UIActivityIndicatorView  (activityIndicatorStyle: UIActivityIndicatorViewStyle.Gray) 
       indicator.color = UIColor .magentaColor()
       indicator.frame = CGRectMake(0.0, 0.0, 10.0, 10.0)
       indicator.center = self.view.center
       self.view.addSubview(indicator)
       indicator.bringSubviewToFront(self.view)
       indicator.startAnimating()
    

提交回复
热议问题