Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate vs dropviews principle #3

Open
jakubknejzlik opened this issue Nov 8, 2014 · 2 comments
Open

Delegate vs dropviews principle #3

jakubknejzlik opened this issue Nov 8, 2014 · 2 comments

Comments

@jakubknejzlik
Copy link
Contributor

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)delegate;
  • (void) setDragMode:(UIViewDragDropMode)mode;
    @EnD

@protocol UIViewDragDropDelegate
....
@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

@ryanmeisters
Copy link
Owner

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 :)

@jakubknejzlik
Copy link
Contributor Author

Sure, remove sound much less aggressive than destroy...I'm currently busy on few projects, but I'll do my best :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants