UIImageView

UIImageView

three20框架

UIImageView的三种初始化

1.-----------普通初始化

使用项目文件夹下的图片

2.-----------使用沙盒里的图片

      获取Documents目录路径的方法:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docDir = [paths objectAtIndex:0];

     获取Caches目录路径的方法:
NSArray*paths=NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachesDir = [paths objectAtIndex:0];

使用Caches途径

根据paths里Index相应的NSString

//添加路径方法

imageWithContentsOfFile+文件名

3.------------------通过URL获取图片

   NSString *instr = @"http:网址路径";

//设置data,加载到aimage

    NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:instr]];

    UIImage *aimage = [UIImage imageWithData:data];

4.UIImageView 动画

设置图片视图组

 uView.animationImages = images;

设置图片持续时间

 uView.animationDuration = 0.1;

开始动画

 [uView startAnimating];

属性

UIImage *image  //图片

UIImage *highlightedImage  

NSArray *animationImages  //UIImageView中的图片组

NSArray *highlightedAnimationImages  //

NSTimeInterval animationDuration   //动画时间

NSInteger      animationRepeatCount  //重复次数

方法

- (void)startAnimating;//开始动画

- (void)stopAnimating;//结束动画

- (BOOL)isAnimating;

posted @ 2012-06-02 10:57  dh99ming  阅读(345)  评论(0编辑  收藏  举报