Re: Using NSRulerView with a non-text view
Re: Using NSRulerView with a non-text view
- Subject: Re: Using NSRulerView with a non-text view
- From: Carlos Eduardo Mello <email@hidden>
- Date: Mon, 16 Feb 2009 19:04:33 -0300
Has anyone used NSRulerView with graphic or other non-text views?
Nothing extensive - I've done some tests to learn NSRulerView and it
seems to work fine with my custom NSViews. My client view is loaded
from a nib per document. After nib is loaded, the ruler is set in
MyDoument (below), which owns the containing scroll view. I then add
various subviews to the client view and adjust the labels when needed
(such as at zooming).
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
// ...
NSArray * stepUp, * stepDown;
NSNumber * upNumber = [ NSNumber numberWithFloat:2.0 ];
NSNumber * downNumber = [ NSNumber numberWithFloat:0.5 ];
stepUp = [ NSArray arrayWithObject:upNumber ];
stepDown = [ NSArray arrayWithObject:downNumber ];
[ NSRulerView registerUnitWithName:@"Seconds" abbreviation:@"s"
unitToPointsConversionFactor:50 stepUpCycle:stepUp
stepDownCycle:stepDown ];
[ [ self scrollView ] setHasHorizontalRuler:YES ];
ruler = [ [ self scrollView ] horizontalRulerView ];
[ ruler setMeasurementUnits:@"Seconds"];
[ [ self scrollView ] setRulersVisible:YES ];
// ...
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden