#import "ViewController.h"@interface ViewController (){UIImageView *_image;NSMutableArray *_milkArray;}@end@implementation ViewController- (void)viewDidLoad {[super viewDidLoad];_image=[[UIImageView alloc] initWithFrame:self.view.bounds];[_image setImage:[UIImage imageNamed:@"stomach_0.jpg"]];[self.view addSubview:_image];float width=self.view.bounds.size.width;float height=self.view.bounds.size.height;UIButton *milkButton=[UIButton buttonWithType:UIButtonTypeCustom];[milkButton setBackgroundColor:[UIColor clearColor]];[milkButton setFrame:CGRectMake(width/2-100, height/2-100, 200, 80)];[self.view addSubview:milkButton];[milkButton addTarget:self action:@selector(milkButtonClick) forControlEvents:UIControlEventTouchUpInside];_milkArray = [NSMutableArray array];for(int i=0;i<=80;i++){//格式化字符串NSString *imgName=[NSString stringWithFormat:@"drink_%d.jpg",i];//创建图片对象UIImage *image=[UIImage imageNamed:imgName];[_milkArray addObject:image];}}-(void)milkButtonClick{[_image setAnimationImages:_milkArray];//设置动画时长[_image setAnimationDuration:10.0];//设置动画重复次数[_image setAnimationRepeatCount:1];[_image startAnimating];}- (void)didReceiveMemoryWarning {[super didReceiveMemoryWarning];// Dispose of any resources that can be recreated.}@end
ios 用objective c语言编写的tomcat动画
最新推荐文章于 2025-12-10 21:33:27 发布
本文探讨了图像处理和AR特效技术的应用,包括OpenGL ES滤镜、OpenCV图像处理等,展示了如何在实际场景中实现高质量的图像效果和增强现实体验。
2468

被折叠的 条评论
为什么被折叠?



