Draggable objects in Cocoa
I am completely new to objective c and have an quite ambitious project I want to create.
One of the things I'll need to do is have a drawing layer, where I can have a circle in the middle, and be able to drag other circles near it to attach them, and then be able to move them around, changing their position around the initial circle.
I know this may sound vague, but its the best way I can explain it.
Could anyone give me some pointers as to how this could be achieved, or a good reference where I could learn how to do it?
Many thanks for any hel开发者_如何学JAVAp you can provide.
There are two protocols that you should look at: NSDraggingDestination
and NSDraggingSource
.
Objective-C is a language that can be used for developing command-line applications, iOS applications, desktop Mac applications and other beasts. The language itself does not handle graphics, that is left to the higher layers. If you want to develop for iOS or Mac, this higher layer is called Cocoa.
To develop your application you’ll need to get familiar with Xcode, Cocoa and maybe a bit of Quartz 2D. Go to the Apple Developer Website and start looking there, the documentation is quite good. The code samples are a bit hairy sometimes, but they will get you started.
精彩评论