NSData *data=[NSData dataWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"photo" ofType:@"jpg"]];
NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
for (int i=0; i<100; i++) {
NSString *photoPath=[path stringByAppendingPathComponent:[NSString stringWithFormat:@"photo_%zi",i]];
UIImage *image = [[UIImage alloc] initWithData:data];
NSData *data1 = UIImagePNGRepresentation(image);
[data1 writeToFile:photoPath atomically:YES];
data1 = nil;
image=nil;
}
data = nil
网友评论