swift UIActivityIndicatorView使用

於德馨
2023-12-01

 声明:var activityLoadingView:UIActivityIndicatorView!


        //显示正在加载的控件

        //初始化方式一

        activityLoadingView =UIActivityIndicatorView(frame: CGRectMake(self.view.frame.size.width/2-25,self.view.frame.size.height/2,50,50))

        self.view.addSubview(activityLoadingView)

        

        activityLoadingView.color =UIColor.redColor()

        activityLoadingView.backgroundColor =UIColor.grayColor()

        activityLoadingView.alpha =0.5;


        //开始加载

        activityLoadingView.startAnimating()

       //加载完成

        activityLoadingView.stopAnimating()


 类似资料: