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;
}
}
が私の答え –