how to make UIbutton draggable within UIView?
问题 I need to drag and drop the button in my dash board i can drag and drop the button using the following code - (void)viewDidLoad { [super viewDidLoad]; [eventButton addTarget:self action:@selector(draggedOut:withEvent:)forControlEvents:UIControlEventTouchDragOutside |UIControlEventTouchDragInside]; } - (void) draggedOut: (UIControl *) c withEvent: (UIEvent *) ev { CGPoint point = [[[ev allTouches] anyObject] locationInView:self.view]; if(point.y > 22 && point.y <300) c.center = CGPointMake(237