タッチでビューに画像を追加する作業。これまでのところ、私のコードでは、画面に触れたときに選択した同じ画像を何度でも追加できます。一度に 1 つずつ画像を追加できるようにして、追加した画像を操作できるようにしたい (拡大/縮小、回転、移動)。
これを許可するには、コードをどのように変更すればよいですか?
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch * touch = [touches anyObject];
touchPoint = [touch locationInView:imageView];
if (touchPoint.x > 0 && touchPoint.y > 0)
{
stampedImage = _imagePicker.selectedImage;
_stampedImageView = [[UIImageView alloc] initWithImage:stampedImage];
_stampedImageView.multipleTouchEnabled = YES;
_stampedImageView.userInteractionEnabled = YES;
[_stampedImageView setFrame:CGRectMake(touchPoint.x, touchPoint.y, 80.0, 80.0)];
_stampedImageView.center = touchPoint;
[imageView addSubview:_stampedImageView];
[_stampedImageView release];
}
}
ありがとう!