Ios objective-c中UIImageView的动画
我是这个领域的新手。 我在UIVIEW中使用了8 UIImageViewIos objective-c中UIImageView的动画,ios,Ios,我是这个领域的新手。 我在UIVIEW中使用了8 UIImageView @property(weak,nonatomic)IBOutlet UIImageView *b1; @property(weak,nonatomic)IBOutlet UIImageView *b2; @property(weak,nonatomic)IBOutlet UIImageView *b3; @property(weak,nonatomic)IBOutlet UIImageVie
@property(weak,nonatomic)IBOutlet UIImageView *b1;
@property(weak,nonatomic)IBOutlet UIImageView *b2;
@property(weak,nonatomic)IBOutlet UIImageView *b3;
@property(weak,nonatomic)IBOutlet UIImageView *b4;
@property(weak,nonatomic)IBOutlet UIImageView *Bb1;
@property(weak,nonatomic)IBOutlet UIImageView *Bb2;
@property(weak,nonatomic)IBOutlet UIImageView *Bb3;
@property(weak,nonatomic)IBOutlet UIImageView *Bb4;
@property(weak,nonatomic)IBOutlet UIView *VVV;
我需要:
当UIViewController加载前4个UIImageView(b1、b2、b3、b4图像)时,应显示已设置的图像。然后,5s后,该4个UIImageView应翻转(对于b1 img,应显示Bb1 img;对于b2 img,翻转后应显示Bb2 img;对于b3-Bb3、b4-Bb4 img,应显示Bb2 img);然后,翻转5s后,应显示b1、b2、b3,UIImageView中的b4 img
小鬼:我需要一段时间
viewDidLoad
不在按钮操作中。在UIImageView中翻转图像时,不需要创建Bb1-4视图。 一般来说,从一个图像过渡到另一个图像有不同的方法。其中一些问题在本回答中有描述(不是我的,学分归塞尔吉奥): 还有一种方法可以在UIImageView中设置动画。图像更改:
+ (void)transitionWithView:(UIView *)view
duration:(NSTimeInterval)duration
options:(UIViewAnimationOptions)options
animations:(void (^)(void))animations
completion:(void (^)(BOOL finished))completion
查看苹果文档,了解这一点:
用法示例:
UIImage *imageOne = [UIImage imageNamed:@"b1"];
UIImage *imageTwo = [UIImage imageNamed:@"bb1"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
imageView.image = imageOne;
[UIView transitionWithView:imageView
duration:2.0
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^{
imageView.image = imageTwo;
} completion:nil];
这里,imageView正在使用flip从imageOne设置动画到imageTwo。我已将Bb1-Bb4设置为UIImageView。我不知道如何执行此操作。我添加了一个如何在UIImageView中设置图像动画的示例。你清楚怎么做吗?据我所知,你需要每5秒钟重复一次这个操作。每次图像都应该从一个切换到另一个?