Tôi cần kéo và thả các nút trong bảng dấu gạch ngang của tôi có thể kéo và thả các nút sử dụng đoạn mã saucách tạo giao diện người dùng có thể kéo trong 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);
}
nhưng tôi cần trong khi kéo và thả tôi cần phải thay đổi vị trí của các nút quá
lưu ý: tôi đã viết code chỉ dành cho một nút
hãy giúp tôi cho câu hỏi của tôi