欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

iOS开发之UIImageView

程序员文章站 2022-07-01 18:38:50
一、始化方法 uiimageview *imageview = [[uiimageview alloc]initwithframe:cgrectmake(100, 100, 100, 100)]...

一、始化方法

uiimageview *imageview = [[uiimageview alloc]initwithframe:cgrectmake(100, 100, 100, 100)];
    imageview.image = [uiimage imagenamed:@"imagename"];
uiimageview *imageview = [[uiimageview alloc]initwithimage:[uiimage imagenamed:@"imagename"]];
uiimageview *imageview = [[uiimageview alloc]initwithimage:[uiimage imagenamed:@"imagename1"]highlightedimage:[uiimage imagenamed:@"imagename2"]];

二、帧动画

imageview.animationduration = imagearray;//imagearray图片帧数组(nsmutablearray *)设置为imageview的帧动画素材数组 imageview.animationduration = 1;//设置动画播放一轮的时间,单位秒 imageview.animationrepeatcount = 0;//设置动画播放的次数,0为无限 [imageview startanimating];//开始播放动画 [imageview stopanimating];//停止播放