标签:uiimageview ios
UIImage是定义一张图片,而UIImageVIew是定义一个视图,然后把图片放进去
- (void)viewDidLoad { [super viewDidLoad]; // UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1"] highlightedImage:[UIImage imageNamed:@"2"]]; UIImageView *imageV = [[UIImageView alloc] init]; imageV.frame = CGRectMake(100, 100, 150, 300); //设置是否允许用户与控件交互 imageV.userInteractionEnabled = YES; //设置图片渲染颜色 imageV.tintColor = [UIColor greenColor]; NSMutableArray *arrayM = [NSMutableArray array]; for (int i=0; i<40; i++) { NSString *name = [NSString stringWithFormat:@"eat_%02d", i]; UIImage *image = [UIImage imageNamed:name]; [arrayM addObject:image]; } //设置图片动画数组 imageV.animationImages = arrayM; //设置播放次数 imageV.animationRepeatCount = 1; //设置总播放时间 imageV.animationDuration = arrayM.count * 0.08; //开始播放动画 [imageV startAnimating]; [self.view addSubview:imageV]; } - (void)startAnimating { NSLog(@"%s", __func__); } - (void)stopAnimating { NSLog(@"%s", __func__); } - (BOOL)isAnimating { NSLog(@"%s", __func__); return YES; }
标签:uiimageview ios
原文地址:http://blog.csdn.net/nethanhan/article/details/45652579