UIImageView、资源管理器

2015-07-07  本文已影响31人  xdkoo

UIImageView、资源管理器

contentMode属性

小语法点


imageView.frame.size = imageView.image.size;


CGRect tempFrame = imageView.frame;

tempFrame.size = imageView.image.size;

imageView.frame = tempFrame;

initWithImage:方法

修改frame的3种方式


imageView.frame = CGRectMake(100, 100, 200, 200);


CGRect tempFrame = imageView.frame;

tempFrame.origin.x = 100;

tempFrame.origin.y = 100;

tempFrame.size.width = 200;

tempFrame.size.height = 200;

imageView.frame = tempFrame;


imageView.frame = (CGRect){{100, 100}, {200, 200}};


UIImage *image = [UIImage imageNamed:@"图片名"];


NSString *file = [[NSBundle mainBundle] pathForResource:@"图片名" ofType:@"图片的扩展名"];

UIImage *image = [UIImage imageWithContentsOfFile:@"图片文件的全路径"];


[abc performSelector:@selector(stand:) withObject:@"123" afterDelay:10];

// 10s后自动调用abc的stand:方法,并且传递@"123"参数


// 创建一个音频文件的URL(URL就是文件路径对象)

NSURL *url = [[NSBundle mainBundle] URLForResource:@"音频文件名" withExtension:@"音频文件的扩展名"];

// 创建播放器

self.player = [AVPlayer playerWithURL:url];

// 播放

[self.player play];

上一篇 下一篇

猜你喜欢

热点阅读