Today a simple example of Drag & Drop with Cocoa and NSView. The screenshot below shows two groups. In the first one, you can drop the photos on your filesystem, taken from Desktop or Finder. In the second group, you can only drop the first group image.
Today I’m playing a bit with Quartz and Cocoa Drawing system (that is based on Quartz).
I’ve made a simple example that you can see below where I’ve used custom NSView that draws an Image and a Bezier Path with some text inside, and around the Bezier Path there’s a Shadow.
Cocoa Drawing Example
…And this is the drawRect method source code of the custom NSView.
It’s a couple of days that I’m searching for something like QHBoxLayout (Qt Horizonal Box Layout) in Cocoa. There’s NSMatrix that do something like this… but it uses NSCell and it sets the same size for all the cells, so this is not what I want. My solution is a simple NSView subclass…
I Really like Apple Mail Note Editor, and today I’ve tried to do something like notes of Mail.app
Mail uses html and css loaded into a WebView (WebKit) to render the background of the window. I’ve used a simple NSView, I’ve Inherited from it and I’ve added a couple of feature to render an image as background pattern. Below you can see the result and here you can Download the Source.