How to use activity indicator view on iPhone?

后端 未结 8 1194
太阳男子
太阳男子 2020-11-29 16:14

An activity indicator view is useful in many applications. Any ideas about how to add, activiate and dismiss an activity indicator view on iPhone?

All the methods fo

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 16:49

    Create:

    spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    [spinner setCenter:CGPointMake(kScreenWidth/2.0, kScreenHeight/2.0)]; // I do this because I'm in landscape mode
    [self.view addSubview:spinner]; // spinner is not visible until started
    

    Start:

    [spinner startAnimating]; 
    

    Stop:

     [spinner stopAnimating];
    

    When you're finally done, remove the spinner from the view and release.

提交回复
热议问题