UIImage存为本地文件,UIImage转换为NSData

 

UIImage *m_imgFore=......;

//png格式

NSData *imagedata=UIImagePNGRepresentation(m_imgFore);

//JEPG格式

//NSData *imagedata=UIImageJEPGRepresentation(m_imgFore,1.0);

NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

NSString *documentsDirectory=[paths objectAtIndex:0]; 

NSString *savedImagePath=[documentsDirectory stringByAppendingPathComponent:@"saveFore.png"];

[imagedata writeToFile:savedImagePath atomically:YES];

 

本地默认存放路径:

Finder---位置----app(用户名)---application support---iphone Sinulator---4.3---Applications--模拟器--

 

你可能感兴趣的:(uiimage)