IOS获取图片方法,避免内存过大闪退

建议使用该方法获取图片
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"sun"  ofType:@"png"];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:imagePath];
  
不要使用下面的方法,图片过大容易造成内存溢出
UIImage *image = [UIImage imageNamed:@"sun.png"];

posted @ 2013-01-06 10:28  废弃账号  阅读(384)  评论(0编辑  收藏  举报