Version: 1.0

Posted: 2009-06-01

Build Requirements: Xcode 3.1.2 or later, Mac OS X v10.5 or later

Runtime Requirements: Mac OS X v10.5 or later

View Source Code:

Download Sample Code (“Rulers.zip”, 98.5K)



Description

This project demonstrates many of the interactions between an NSRulerView and its client view. It should give you an idea how to go about this when creating a view subclass that really does something.

The principal class, RectsView, displays colored rectangles that the user can select and drag around. The RectsView puts markers in the horizontal and vertical rulers showing the placement of the rectangle; manipulating these markers changes the size of the selected rectangle. Removing a marker deletes the selected rectangle, and clicking in the ruler area creates a new rectangle. The user can also lock a rectangle down, so that the markers can't be moved.

Document Revision History

Date Notes
2009-06-01This project demonstrates many of the interactions between an NSRulerView and its client view.