我正在尝试制作动画,并且仅在动画完成时转移。.但是除了segue之外,其他一切都正常。当我单击按钮时,它导航到另一页...在动画完成之前...我ios上的一只新蜜蜂,请提及我的错误...
#import "ViewController.h"
#import <Lottie/lottie.h>
@interface ViewController ()
@property UIView * AnimatedViewForLoading;
@property LOTAnimationView * LottieAnimationHourGlass;
@end
-(IBAction)ButtonTouched:(id)sender {
self.AnimatedViewForLoading = [[UIView alloc] initWithFrame:CGRectMake(118, 318, 200, 150)];
[self.AnimatedViewForLoading setBackgroundColor:[UIColor clearColor]];
// self.AnimatedViewForLoading.alpha = 0.0f;
//AnimatedViewForLoading.backgroundColor = UIColor.lightGrayColor;
self.LottieAnimationHourGlass = [LOTAnimationView animationNamed:@"hourglass"];
self.LottieAnimationHourGlass.frame = CGRectMake(118, 318, 200, 150);
// if(!UIAccessibilityIsReduceTransparencyEnabled()){
// self.view.backgroundColor = [UIColor clearColor];
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *blureffectview = [[UIVisualEffectView alloc]initWithEffect:blurEffect];
blureffectview.frame = self.view.bounds;
blureffectview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:blureffectview];
[self.view insertSubview:_AnimatedViewForLoading aboveSubview:blureffectview];
//[self.view sendSubviewToBack:_AnimatedViewForLoading];
[self.view insertSubview:_LottieAnimationHourGlass aboveSubview:_AnimatedViewForLoading];
[_LottieAnimationHourGlass play];
_LottieAnimationHourGlass.loopAnimation = YES;
// }else{
//self.view.backgroundColor = [UIColor blackColor];
// }
self.AnimatedViewForLoading.transform = CGAffineTransformMakeScale(0.01, 0.01);
[UIView animateWithDuration:10.0 delay:3.0 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.AnimatedViewForLoading.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
} completion:^(BOOL finished) {
NSLog(@"oopssssss..........");
[UIView animateWithDuration:0.3/2 animations:^{
self.AnimatedViewForLoading.transform = CGAffineTransformIdentity;
}];
if (finished == true) {
[self dismissViewControllerAnimated:YES completion:nil];
[self performSegueWithIdentifier:@"YourTimeisLoading" sender:_AnimatedViewForLoading];
}
}];
//[self dismissViewControllerAnimated:YES completion:nil];
}
答案 0 :(得分:1)
场景1:
检查您的第二次完成
[UIView animateWithDuration:10.0 delay:3.0 options:UIViewAnimationOptionCurveEaseOut animations:^{
self.AnimatedViewForLoading.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
} completion:^(BOOL finished) {
NSLog(@"oopssssss..........");
[UIView animateWithDuration:0.3/2 animations:^{
self.AnimatedViewForLoading.transform = CGAffineTransformIdentity;
} completion:^(BOOL finished) {
[self dismissViewControllerAnimated:YES completion:nil];
[self performSegueWithIdentifier:@"YourTimeisLoading" sender:_AnimatedViewForLoading];
}];
}];
场景2:
确保performSegueWithIdentifier
与不直接在按钮中定向的VC连接后。如果其直接与UIButton连接,则不会考虑动作处理程序中的任何内容。