How to display an activity indicator with text on iOS 8 with Swift?

前端 未结 14 2201
没有蜡笔的小新
没有蜡笔的小新 2020-11-27 08:58

I wanna show, programmatically, an activity indicator with text, like the one in the Photos app (after editing and saving a picture). How can I do this?

14条回答
  •  星月不相逢
    2020-11-27 09:50

    This code work in SWIFT 2.0.

    Must Declare a variable for initialize UIActivityIndicatorView

    let actInd: UIActivityIndicatorView = UIActivityIndicatorView() 
    

    After initialize put this code in your controller.

    actInd.center = ImageView.center
    actInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge
    view.addSubview(actInd)
    actInd.startAnimating()
    

    after your download process complete then hide a animation.

    self.actInd.stopAnimating()
    

提交回复
热议问题