Xcode 4.6.3, OS X Lion 10.7.5, my Document app for OS X

Here are quotes from the View Programming Guide 2013-08-08
"By default, the graphics environment origin (0.0,0.0) is located in the lower 
left,…." page 11  
"The frame rectangle defines the view's location and size in the superview 
using the superview’s coordinate system.
 The bounds rectangle defines the interior coordinate system that is used when 
drawing the contents of the view, including the origin and scaling." page 12
"The content view acts as the root of the visible view hierarchy in a window." 
Page 17 

I understand the above.

My code: (N.B. I need to create the Matrix programatically because of the 
prototype Cell).
- (void)windowControllerDidLoadNib:(NSWindowController *)aController {
    [super windowControllerDidLoadNib:aController];
    // Add any code here that needs to be executed once the windowController 
has loaded the document's window.
    
    // Get the initial content view size so as to
    // (a)compute where to place the matrix and
    // (b)what size to make the matrix cells
    
    // Local vars for this method
    NSWindow *theWindow      = [aController window];
    NSView   *theContentView = theWindow.contentView;
    NSRect   theContentFrame = theContentView.frame;
    NSRect   theMatrixFrame  = NSInsetRect(theContentFrame, 40.0, 40.);
    Cell     *protoCell      = Cell new];
    
    // Instance vars   
    _theMatrix = [[Matrix alloc]initWithFrame:theMatrixFrame 
        mode:NSListModeMatrix prototype:protoCell 
        numberOfRows:3 numberOfColumns:3];
    
    [theContentView addSubview:_theMatrix];   
}

My questions:
(0) Given the above documentation why is the matrix drawn at top left (indented 
of course)?
The default location is stated to be lower left.

(1) Is the contentView's superView the screen? 
And thus the contentView uses the screen's origin co-ordinates which are top 
left?

TIA

Peter

PS: If my memory is correct, from the beginning of Mac OS up till OS X the 
origin was top left.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to