Ich bin UIImage in einer Ansicht verschieben. Jetzt, wenn das Bild an eine neue Position verschoben wird, möchte ich dieses Bild in dieser Position behalten und das in einem Array speichern. Wie kann ich das erreichen?Mit UIPanGesture speichern Sie den Speicherort des Bildes an einen neuen Speicherort in der UIView in Objc
Der Code für Bewegtbild Pan Geste verwendet, ist: -
- (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;
}
}
meine Antwort –