您的位置:首页 > 其它

IPA PNG图片转换

2012-06-24 10:55 155 查看
- (void)loadAllBundleImage
{
NSArray * imagesPath = [NSBundle pathsForResourcesOfType:@"png" inDirectory:[[NSBundle mainBundle]bundlePath]];
for (NSString * a in imagesPath) {
NSData * idata =UIImagePNGRepresentation([UIImage imageWithContentsOfFile:a]);
[self writeApplicationData: idata toFile: [a lastPathComponent]];
}
}
- (BOOL)writeApplicationData:(NSData *)data toFile:(NSString *)fileName
{
NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
if (!documentsDirectory) {
NSLog(@"Documents directory not found!");
return NO;
}
NSString *appFile = [documentsDirectory stringByAppendingPathComponent:fileName];
return ([data writeToFile:appFile atomically:YES]);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: