1

この方法で画像を別の画像に追加し、マージ結果を取得します

- (UIImage*) createImage{
    UIImage *imageToShare = nil;
    UIImageView* imageView = [[UIImageView alloc] initWithFrame:[self.view frame]];
    imageView.image = currentImage;
    UIImageView* subView   = [[UIImageView alloc] initWithImage:imageToUse.image];
    [imageView addSubview:subView];

    UIGraphicsBeginImageContext(imageView.frame.size);
    [imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
    imageToShare = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    [subView release];
    [imageView release];
    return imageToShare;
}

私のimageToShareは大丈夫なので問題ありませんが、問題は「subView」が回転してピンチしてズームおよび移動できる画像であることです...次に、このメソッドsubViewを実行すると、元の位置に戻ります...何ができるかimageView 上の状態位置に保存するにはどうすればよいですか?

4

1 に答える 1

0

2 つの画像をマージし、マージ結果を保持し、ユーザーがそれをさらに操作できるようにする場合は、特定のサイズでオフスクリーン コンテキストに描画し、CGImageRef を作成して、それを画像に割り当てることをお勧めします。見る。この質問と回答を見て、それがどのように行われたかを確認してください。

于 2013-01-18T16:57:10.463 に答える