0
正在处理通过触摸将图像添加到视图。到目前为止,我的代码允许我在触摸屏幕时添加与我想要的次数相同的图像。我希望能够一次添加一张图像,这样我就可以操作添加的图像(放大/缩小,旋转,移动)。如何通过触摸仅添加一个图像
我该如何修改我的代码以允许这样做?
-(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];
}
}
谢谢!