致力于通过触摸将图像添加到视图中。到目前为止,我的代码允许我在触摸屏幕时添加我想要多次选择的相同图像。我希望能够一次添加一个图像,以便我可以操作添加的图像(放大/缩小、旋转、移动)。
我应该如何修改我的代码以允许这样做?
-(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];
}
}
谢谢!