ユーザーが画像を選択し、(uiscrollview で) ズームしてサイズを変更し、ビュー内で移動するアプリを作成しています。終了したら、uiscrollview で見られるように画像を保存したいと思います。何か考えはありますか?
ありがとう。
ユーザーが画像を選択し、(uiscrollview で) ズームしてサイズを変更し、ビュー内で移動するアプリを作成しています。終了したら、uiscrollview で見られるように画像を保存したいと思います。何か考えはありますか?
ありがとう。
これがコードです.....。
ここでfrontGroundはimageviewであり、testScroolはスクロールビューです
これがあなたのために働くことを願っています。
UIGraphicsBeginImageContext(testScrool.frame.size);
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGRect clippedRect = CGRectMake(0, 0, testScrool.frame.size.width, testScrool.frame.size.height);
CGContextClipToRect(currentContext, clippedRect);
CGRect drawRect = CGRectMake(testScrool.frame.origin.x * -1,
testScrool.frame.origin.y * -1,frontGround.frame.size.width, frontGround.frame.size.height);
CGContextDrawImage(currentContext, drawRect, frontGround.image.CGImage);
UIImage *cropped = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
frontGround.image = cropped;