活动指示器没有立即开始动画
我初始化一个活动指示器,并在按下按钮的操作中启动它的动画并调用下一个要显示的视图。
-(IBAction) downloadButtonPressed:(id)sender {
NSLog(@"Download Button Pressed");
indicator.hidden = NO;
[indicator startAnimating];
if (addviewcontroller == nil)
addviewcontroller = [[AddViewController alloc]init];
[self.view addSubview:addviewcontroller.view];
[addviewcontroller setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentModalViewController:addviewcontroller animated:YES];
}
当我按下按钮时,活动指示器不会立即启动。它在调用另一个视图时启动。该指示器会显示一秒钟,但是当按下按钮时,需要一些时间来加载其他视图。
我不知道为什么指示灯显示一秒钟而没有启动。
I initialize an activity indicator and in a button press action I start it animating and call the next view to display.
-(IBAction) downloadButtonPressed:(id)sender {
NSLog(@"Download Button Pressed");
indicator.hidden = NO;
[indicator startAnimating];
if (addviewcontroller == nil)
addviewcontroller = [[AddViewController alloc]init];
[self.view addSubview:addviewcontroller.view];
[addviewcontroller setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentModalViewController:addviewcontroller animated:YES];
}
When I press the button, the activity indicator doesn't start immediately. It starts when the other view is called. The indicator is displayed for a second, but when the button is pressed it takes some time to load the other view.
I dont know why the indicator shows for a second without starting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
应该可以解决问题;-)
编辑
我刚刚注意到您的代码中有一个问题,您添加了
addviewcontroller
两次。一种是将其添加为实际视图控制器的子视图,另一种是通过模态呈现另一个视图控制器。您应该从此函数中删除其中一条语句。Try this :
That should do the trick ;-)
EDIT
I just noticed that there is a problem in your code, you are adding your
addviewcontroller
twice. One by adding it as a subview of the actual view controller, and one by modally presenting another view controller. You should remove one of the statements from this function.