objective c - ios drag and drop subview only working once -
I have UIView in which I want to be able to drag and drop the subview, and it is working fine Once . I wonder if this is working once. Code> message can replace the entire subview-search loop.
- (zero) pan: (UIPanGestureRecognizer *) identifier {if (recognizer.state == UIGestureRecognizerStateBegan) {CGPoint startPos = [identifier location InView: self]; (Self.subviews in UIControl * sv) {If ([sv point end startPos withEvent: zero]) {self.controlBeingDragged = sv; }}} If (((recognizer.state == UIGestureRecognizerStateChanged) || (recognizer.state == UIGestureRecognizerStateEnded)) & amp; amp; amp; & amp; amp; amp; amp; ControlBeingDragged) {CGPoint Translation = [Identifier Translation InView: self ]; Self.controlBeingDragged.center = CPExMake (Self ControlledBangraGrid Center.x + TranslationX, Setroiling Dredged Center. + Translation.); [Identifier set conversion: CGPointZero inView: self]; If (recognizer.state == UIGestureRecognizerStateEnded) {self.controlBeingDragged = zero; However, if I try to pull the same UIControll again, that scene will no longer know where it is. I can pull it back again from the original state, so clearly there is something that I am not doing to inform the view that its subview has been taken but what? point-in: accompanying document: requires a point in receiver's coordinate system, but you send a point in the receiver's supervision coordinate system Are there. pointInside: withEvent: Before sending a point in the message, you can use convertPoint: toView: to change the point in the subview's coordinating system. CGPaint SubViewpoint = [Self Convertpoint: Startpages to Value: SV]; If you want to see if the - [UIView hitTest: withEvent:]
Comments
Post a Comment