IOS基础-UIImageView
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; }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。