5
我需要拖动和我的仪表板将按钮拖放我可以拖动和使用下面的代码如何使UIbutton在UIView内拖动?
- (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, point.y - c.bounds.size.height/2 -5);
}
下降的按钮,但我需要同时拖放我需要更改按钮的位置过于
注:我写的代码只有一个按钮
请帮我要我的问题