Reputation: 217
I need help finding the starting point: I want to programmatically create a NSButton as a draggable object in Swift. Do I need to subclass NSButton? Do I need a drag handler? There are a few tutorials on this topic, but they're all for iOS and I'm not safe enough to translate that to OS X. Any help would be appreciated.
Upvotes: 1
Views: 201
Reputation: 2841
Simple, make a subclass of your button which you want to be draggable . something like this @interface CustomButtonSpecial : UIButton . (you got my meaning, you can take the equivalent in swift i.e UIGestureRecognizerDelegate.
and then use UILongPressGestureRecognizer , add it to your custom button and implement your logic then, what you want this custom buttom to do.
Upvotes: 1