내 스크롤러 내에있는 이미지를 스크롤러에서 이미지 뷰로 끌 수 있는지 어떻게 확인할 수 있습니까?해당 위치를 손상시키지 않고 스크롤 뷰에서 이미지를 드래그
또한 '흔들기'를 구현하고 싶습니다. 사용자가 스크롤러 내에서 이미지를 탭하면 이미지가 흔들리고 사용자의 터치가 다른보기로 이어집니다. 하위 뷰를 만드는 것으로 시작했지만 이미지가 정상보기로 표시 될 때 위치가 바뀌지 않고 뷰의 맨 위에 표시됩니다.
- 이미지 흔들
- 이미지가 다른보기로 이동 :
어떻게 내가 이미지를 터치하면 확인 할 수 있습니다.
- 이미지가 사용하는 대신에
(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:self.view];
image1.userInteractionEnabled = YES;
[self.view addSubview:image1];
if([touch view] == image1){
image1.center = location;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.14];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:1000000];
image1.transform = CGAffineTransformMakeRotation(69);
image1.transform = CGAffineTransformMakeRotation(-69);
[UIView commitAnimations];
image1.center = CGPointMake(30,870);
}
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *) event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:self.view];
if([touch view] == image1){
image1.userInteractionEnabled = YES;
[self.view addSubview:image1];
image1.center = location;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.14];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:1000000];
image1.transform = CGAffineTransformMakeRotation(69);
image1.transform = CGAffineTransformMakeRotation(-69);
[UIView commitAnimations];
}