gpt4 book ai didi

objective-c - UIActivityIndi​​cator 没有动画

转载 作者:行者123 更新时间:2023-11-29 13:43:42 39 4
gpt4 key购买 nike

- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];

self.connectionIndicator = [[[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] autorelease];
[self.view addSubview:connectionIndicator];

[self.connectionIndicator setCenter:CGPointMake(self.view.frame.size.width/2, 15)];
[connectionIndicator startAnimating];
}

微调器显示为卡住状态,并且没有开始动画。

编辑:好的,我找到了原因,但还没有找到解决方案。

这个 View Controller 通过页面 curl 转换被插入导航 Controller 堆栈:

ServerHandshakeViewController *shvc = [[ServerHandshakeViewController alloc] initWithHost:h];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0];
[self.navigationController pushViewController:shvc animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
[shvc release];

像下面这样删除上面的 curl 过渡解决了微调器卡住问题。

ServerHandshakeViewController *shvc = [[ServerHandshakeViewController alloc] initWithHost:h];
[self.navigationController pushViewController:shvc animated:NO];
[shvc release];

但是,如果我想保留 curl 页面过渡怎么办?

最佳答案

您可以尝试使用可以指定动画选项的 block 方法。 UIViewAnimationOptionAllowAnimatedContent 是应该释放微调器的选项。

[UIView transitionWithView:self.navigationController.view 
duration:1.0
options:UIViewAnimationOptionAllowAnimatedContent | UIViewAnimationTransitionCurlUp | UIViewAnimationOptionCurveEaseInOut
animations:^{[self.navigationController pushViewController:shvc animated:NO];}
completion:nil];

关于objective-c - UIActivityIndi​​cator 没有动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8268553/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com