活动指示器在视图控制器导航到另一个视图控制器时未开始动画 [英] Activity Indicator Not start Animating when the view controller is navigate to another view controller
本文介绍了活动指示器在视图控制器导航到另一个视图控制器时未开始动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我当前在启动另一个视图控制器之前启动了活动指示器,但是它没有开始为活动指示器设置动画.
I currently starting the activity indicator before pushing another view controller but it is not start animating the activity indicator.
[activityindicator startanimating];
[self.navigationcontroller pushviewcontroller:viewcontroller animated:YES];
[activityindicator stopanimating];
推荐答案
创建一个NSThread作为调用选择器,如下所示:
Create a NSThread as call a selector as follows :
[NSThread detachNewThreadSelector:@selector(threadStartAnimating:) toTarget:self withObject:nil];
// Some code
[spinner stopAnimating];
[self.navigationcontroller pushviewcontroller:viewcontroller animated:YES];
threadStartAnimating:
threadStartAnimating :
-(void)threadStartAnimating:(id)data
{
[spinner startAnimating];
}
这篇关于活动指示器在视图控制器导航到另一个视图控制器时未开始动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文