gpt4 book ai didi

ios - UiView 动画不调用 setAnimationDidStopSelector

转载 作者:行者123 更新时间:2023-11-28 22:21:10 30 4
gpt4 key购买 nike

我创建了这个动画,我通过停止动画进入了

[UIView setAnimationDidStopSelector:@selector (TermineAnimazioneGoPointAssignedWithDelay)] ;

当 SetAnimationDidStop 的动画部分未被调用时...您能告诉我为什么以及哪里做错了吗?

这是一路动画:

-(void)setViewStatusGoPointassigned {
ViewgoPointAssignMessage = [[UIView alloc] initWithFrame:CGRectMake(115, 150, 100, 100) ];
ViewgoPointAssignMessage.backgroundColor = [UIColor colorWithRed:(77/255.0) green:(108/255.0) blue:(143/255.0) alpha:(1)];
[ViewgoPointAssignMessage.layer setCornerRadius:10.0f];
[ViewgoPointAssignMessage.layer setMasksToBounds:YES];

[UIView animateWithDuration:0.2 animations:^{

ViewgoPointAssignMessage.transform = CGAffineTransformMakeScale(1.05, 1.05);
ViewgoPointAssignMessage.alpha = 0.8; }
completion:^(BOOL finished){

[UIView animateWithDuration:2/15.0 animations:^{
ViewgoPointAssignMessage.transform = CGAffineTransformMakeScale(0.9, 0.9);
ViewgoPointAssignMessage.alpha = 0.9; }
completion:^(BOOL finished) {

[UIView animateWithDuration:1/7.5 animations:^{
ViewgoPointAssignMessage.transform = CGAffineTransformIdentity;
ViewgoPointAssignMessage.alpha = 1.0; } ];


} ];
} ];

[self.view addSubview:ViewgoPointAssignMessage];
[UIView setAnimationDidStopSelector:@selector(TermineAnimazioneGoPointAssignedWithDelay)];

}

-(void)TermineAnimazioneGoPointAssignedWithDelay {
[self performSelector:@selector(EliminazioneViewAfterDelay) withObject:self afterDelay:0.01];
}
-(void)EliminazioneViewAfterDelay {
CGRect endREct;
endREct = CGRectMake(350 , 0 , 330, 90);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.005];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(EliminaAnimazione)];
ViewgoPointAssignMessage.frame = endREct;
[UIView commitAnimations];

}
- (void)EliminaAnimazione {
[ViewgoPointAssignMessage removeFromSuperview];

}

最佳答案

首先,回答你的问题。你可以试试

[UIView animateWithDuration:(NSTimeInterval)duration animations:^(void)animations completion:^(BOOL finished)completion]

然后调用[self TermineAnimazioneGoPointAssignedWithDelay]在完成中。

其次,[UIView setAnimationDidStopSelector:@selector(TermineAnimazioneGoPointAssignedWithDelay)]不起作用,因为根据引用,setAnimationDidStopSelector 必须在 调用 beginAnimations:context: 和 commitAnimations 方法之间调用。由于您的代码不符合此规则,因此该功能也不起作用。

希望它能解释清楚!祝你好运!

关于ios - UiView 动画不调用 setAnimationDidStopSelector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20357824/

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