-(void)drawJPEG
{
NSArray* objects = [[NSBundle mainBundle] loadNibNamed:@"View" owner:nil options:nil];
UIView* mainView = [objects objectAtIndex:0];
for (UIView* view in [mainView subviews]) {
if([view isKindOfClass:[UIImageView class]])
{
UIImage* PassportSizePhoto = [UIImage imageNamed:@"1.jpeg"];
[self drawImage:PassportSizePhoto inRect:view.frame];
}
}
UIImage *image;
UIGraphicsBeginImageContext(mainView.bounds.size);
{
[mainView.layer renderInContext:UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();
}
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
答案 0 :(得分:-1)
请不要期待通过间接利用其他人辛苦获得的专业知识来实现已经烘焙过的代码。
请给自己一些时间阅读Apple关于图片的文档。
UIImageJPEGRepresentation
。Stack-overflow
以将图片大小调整为所需大小。这是一个非常简单的东西,在堆栈溢出时问了几百万次。