UIView-DragDrop
UIView-DragDrop copied to clipboard
Delegate vs dropviews principle
One question/suggestion. I would like to know your opinion about leaving the decision of what view can be dropped in another view to the delegate and the interface shoudl be:
@interface UIView (DragDrop)
- (void) makeDraggable;
- (void) makeDroppable;
- (void) setDragDropDelegate:(id<UIViewDragDropDelegate>)delegate;
- (void) setDragMode:(UIViewDragDropMode)mode; @end
@protocol UIViewDragDropDelegate <NSObject> .... @optional
- (BOOL)draggableView:(UIView *)view shoudDropOnDroppableView:(UIView *)view;
.... @end
Looks easier to me when using it (i can dynamicaly add draggables/droppables and all is handled in delegate). Also method for destroying the draggable/droppable behaviour of view could be useful (something like -(void)destroyDraggable; -(void)destroyDroppable;)
Also if You are interested in any contribution It'll be my pleasure :)
Cheers
Hey @jakubknejzlik. My apologies for taking so long to reply to your issues and pull request.
I think draggableView:shouldDropOnDroppableView:
is a great idea and would greatly increase the flexibility of this little category.
I also agree that methods should be added for removing dropViews and drag functionality, though I don't think I like the word "destroy".
Perhaps something like this:
@interface UIView (DragDrop)
...
// remove the drag functionality from a UIView
- (void) removeDraggable;
// remove a specific dropView from the draggable view's list of drop views
- (void) removeDropView:(UIView *)dropView;
// remove all dropViews from a draggableView
- (void) removeAllDropViews;
@end
What do you think? If you're still interested in contributing, please do! I will do my best to merge future pull requests and get the cocaopod updated in a more timely manner :)
Sure, remove sound much less aggressive than destroy...I'm currently busy on few projects, but I'll do my best :)