How to display activity indicator in middle of the iphone screen?

前端 未结 15 1036
盖世英雄少女心
盖世英雄少女心 2020-12-22 22:43

When we draw the image, we want to display the activity indicator. Can anyone help us?

15条回答
  •  轮回少年
    2020-12-22 23:03

    For Swift 3 you can use the following:

     func setupSpinner(){
        spinner = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 40, height:40))
        spinner.color = UIColor(Colors.Accent)
        self.spinner.center = CGPoint(x:UIScreen.main.bounds.size.width / 2, y:UIScreen.main.bounds.size.height / 2)
        self.view.addSubview(spinner)
        spinner.hidesWhenStopped = true
    }
    

提交回复
热议问题