收到内存警告崩溃弧uiimageview

时间:2014-03-13 03:41:24

标签: ios iphone virtual-machine

根据vm仿真器图像IO_PNG_Data执行限制并导致崩溃。我正在使用以下代码加载图像视图。我已经研究了很多,但没有任何帮助。

CALayer *imageLayer = self.img_user.layer;  
[imageLayer setBorderWidth:1];
[imageLayer setMasksToBounds:YES];
[imageLayer setCornerRadius:img_user.frame.size.width/2];
img_user.image =[UIImage imageWithContentsOfFile:getimgpath];

这里getpath是cashe的图像,我已经存储了来自casl的url的图像

NSString *stringURL = getpicurl;
NSURL  *url = [NSURL URLWithString:stringURL];
NSData *urlData = [NSData dataWithContentsOfURL:url];
if ( urlData )
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString  *documentsDirectory = [paths objectAtIndex:0];

    NSString  *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory,@"userpic.png"];
    [urlData writeToFile:filePath atomically:YES];
    //obj_AppDelegate.img_path=filePath;
    setimgpath(filePath);
}

每次内存执行时加载uiimageview,并且崩溃请帮忙。

0 个答案:

没有答案
相关问题