터치로 뷰에 이미지를 추가하는 작업. 지금까지 내 코드를 사용하면 화면을 터치 할 때 원하는만큼 여러 번 선택하여 동일한 이미지를 추가 할 수있었습니다. 추가 된 이미지 (확대/축소, 회전, 이동)를 조작 할 수 있도록 한 번에 하나씩 이미지를 추가 할 수 있기를 원합니다.터치로 하나의 이미지 만 추가하는 방법
허용하려면 코드를 어떻게 수정해야합니까?
-(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];
}
}
고마워요!