Programming examples in Objective-C using Cocoa for OS X Leopard

This part of the site is still under construction

PearCity: QuickTime Movie (click image to play: 13.2Mb)

The pages in this part of the website provide coding examples created as part of my learning to program the Mac. I hope they will be useful to others.

Programming in Objective-C using Cocoa on Mac OS X Leopard

Despite having spent some thirty years programming a variety of computers in various programming languages it took me more than 6 months to learn enough to create the range of interface designs I needed to write serious programs for my beautiful Mac G4 running OS X.

I hope this admission will hearten programmers who also have found it hard to learn Cocoa, XCode and Interface Builder.

These pages provide some examples of the types of things needed to use the system. I add to them as I can. Kindly tell me of any difficulties you find.

The examples are implemented in Leopard so if you're looking for examples using Tiger I'm sorry. Going over to Leopard and XCode 3 was a good move or I'd still be tearing my hair out. I'm not out of the woods yet but.

All the examples use automatic Garbage Collection.



Please send me your comments

If you include your e-mail I may reply!  

Page last modified: 19:21 Sunday 16th. November 2008

Julius Guzy

Paintings & Drawings

  • view of the Donegal Shop from the bottom of Shipquay Street, Derry

animatedPaint

  • Link to animatedPaint page
  • Link to example of implementing a cocoa button in xcode and interface builder
    • Example: Button
  • Link to example of implementing a couple of cocoa menu items in xcode and interface builder
    • Example: Menu Item
  • Link to example of implementing a cocoa nsslider in xcode and interface builder
    • Example: Horizontal Slider
  • Link to example of NSTextField, first responder and NextKeyView in xcode and interface builder
    • TextField first responder and NextKeyView
  • Link to example of NSTextView, first responder and NextKeyView in xcode and interface builder
    • NSTextView get keyDown events
  • Link to example of Cocoa NSTextView with delegate in xcode and interface builder
    • NSTextView with delegate
  • Link to example of Cocoa NSKeyedArchiver, archiving variant of NSArchiver xcode and interface builder
    • Archiving using NSKeyedArchiver variant of NSArchiver
  • Link to example of Cocoa NSArchiver, xcode and interface builder
    • Archiving using NSArchiver
  • Link to example of Cocoa NSSavePanel and NSOpenPanel, xcode and interface builder
    • NSSavePanel and NSOpenPanel
  • Link to example of drawing mouse strokes to a view using Quartz graphics in Cocoa, xcode and interface builder
    • Drawing using Quartz and a mouse
  • Link to example of displaying a panel in Cocoa, xcode and interface builder
    • Display a panel by clicking a menu item
  • Link to example of using a test rig to experiment with Cocoa classes
    • A simple test rig
  • Link to example of How to know when initialisation (initialization) is complete at program start
    • How to know when initialisation (initialization) is complete
  • Link to example of communication between controller and custom NSView using IBOutlet
    • Communication between controller and custom NSView using IBOutlet
  • Link to example of Two way communication between NSView and NSControl using dummy class
    • Two way communication between NSView and NSControl using dummy class
  • Link to example of Two way communication between NSView and NSControl without using dummy class
    • Two way communication between NSView and NSControl without using dummy class
  • Link to example of communicationg using NSNotification
    • Communicate using NSNotification
  • Link to example of communicationg with objects using bindings, Key Value Coding (KVC) and Key Value Observing (KVO) using addObserver and observeValueForKeyPath
    • Communicate with objects using bindings, KVC, KVO, addObserver and observeValueForKeyPath
  • Link to example of communicationg with NSView inside aNSCollectionsView without using bindings.
    • Communicate with NSView inside a NSCollectionsView without using bindings
  • Link to example of NSTableView.
    • Display, add and delete data from an NSTableView
  • Link to example of displaying many NSViews via NSViewController using same  nib in same window.
    • Display different renditions of the same nib (xib) in the one window
  • Link to example of displaying different coloured NSViews via NSViewController using same  nib in same window.
    • Display different coloured versions of the same nib (xib) in the one window
  • Link to example of using the same nib to create different windows.
    • Use the same nib to create different windows.
  • Link to example of drawing with Quartz.
    • Simple drawing using quartz.
  • Link to Quartz drawing with Bitmap and Garbage Collection.
    • Quartz drawing with Bitmap and Garbage Collection.
  • Link to NSBitmapImageRep read, edit and write tiff file.
    • Read TIFF file into NSBitmapImageRep, edit it and write it.
  • Link to NSBitmapImageRep animation with NSTimer.
    • Create an animation using NSBitmapImageRep and NSTimer.
  • Link to Cocoa Garbage Collection problem when using a nib file.
    • Stop the Garbage Collector from collecting objects in your nib file.
  • Link to Cocoa NSUndoManager undo redo examples.
    • Simple example of using the NSUndoManager.