gpt4 book ai didi

ios - Viewcontroller 在动画完成之前显示

转载 作者:行者123 更新时间:2023-11-29 11:33:33 25 4
gpt4 key购买 nike

我正在尝试制作动画并仅在动画完成时才进行传输..但除了 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];

}

最佳答案

场景一:

检查你的第二次完成

[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,它不会考虑 Action 处理程序中的任何内容。

关于ios - Viewcontroller 在动画完成之前显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51257957/

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