一.读取图片
1.从资源(resource)读取
[cpp]
view plain
copy
print
?
- UIImage*
image=[UIImage "1.jpg"];imageNamed:@
2.从网络读取
[cpp]
view plain
copy
print
?
- NSURL
*url=[NSURL "http://attach.bbs.miui.com/forum/201203/20/170226n5qcwdpusnjdsswy.jpg"];URLWithString:@ - UIImage
*imgFromUrl =[[UIImage alloc]initWithData:[NSData dataWithContentsOfURL:url]];
3.从手机本地读取
[cpp]
view plain
copy
print
?
- //读取本地图片非resource
- NSString
*aPath3=[NSString stringWithFormat:@"%@/Documents/%@.jpg",NSHomeDirectory(),@"test"];