뷰에서 UIImage를 이동 중입니다. 이제 이미지가 새로운 위치로 옮길 때 그 이미지를 그 위치에 보관하고 배열에 저장하려고합니다. 이것을 어떻게 할 수 있습니까?UIPanGesture를 사용하여 Objc의 UIView에서 새 위치로 이동 한 이미지의 위치를 저장하십시오.
팬 제스처를 사용하여 이미지를 이동시키기위한 코드는 : -
- (void) handlePan: (UIPanGestureRecognizer *) recogniser {
CGPoint point = [recognizer locationInView:_backImage];
//Only allow movement up to within 100 pixels of the right bound of the screen
if (point.x < [UIScreen mainScreen].bounds.size.width - 100) {
CGRect newframe = CGRectMake(point.x, point.y, smallImageViewWidth, smallImageViewHeight);
_centreImage.frame = newframe;
}
}
내 대답 –