Basic Drawing and Event Handling
Version 1.2, 2012-07-12
1) Updated to use ARC and modern Objective-C syntax (including use of properties and autosynthesis). 2) Refactored drawing code into ASCSquiggle. 3) Converted document-based application to a window-based application. 4) Updated *.nib to *.xib 5) Updated comments, and also reformatted some of the comments. 6) Added logical pragma marks to separate different parts of the code. 7) Each class now has ASC (Apple Sample Code) prefixes.
(Full Revision History)
Mac OS X 10.8 or later, Xcode 4.5 or later
Mac OS X 10.7 or later
"Squiggles" is a Cocoa application that shows how you can perform custom drawing and event-handling in a subclass of NSView. The sample illustrates: * Use of NSView's -drawRect: to implement custom drawing. * Use of NSView's -mouseDown: and -mouseDragged: to handle user events. * Use of NSBezierPath to draw lines.
© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-07-12)