码迷,mamicode.com
首页 > 移动开发 > 详细

IOS基础-UIImageView

时间:2015-05-12 00:07:49      阅读:119      评论:0      收藏:0      [点我收藏+]

标签: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;
}


IOS基础-UIImageView

标签:uiimageview   ios   

原文地址:http://blog.csdn.net/nethanhan/article/details/45652579

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!