• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
View hierarchy, documentation, and origin location.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

View hierarchy, documentation, and origin location.


  • Subject: View hierarchy, documentation, and origin location.
  • From: Peter Teeson <email@hidden>
  • Date: Mon, 23 Sep 2013 12:09:56 -0400

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 (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


  • Follow-Ups:
    • Re: View hierarchy, documentation, and origin location.
      • From: Dave <email@hidden>
    • Re: View hierarchy, documentation, and origin location.
      • From: Kyle Sluder <email@hidden>
    • Re: View hierarchy, documentation, and origin location.
      • From: "Gary L. Wade" <email@hidden>
  • Prev by Date: Re: Strange behaviour of iPhone
  • Next by Date: Re: Correct usage of NSTextView and NSFindBar
  • Previous by thread: Re: Grouped table view appearance in iOS 7
  • Next by thread: Re: View hierarchy, documentation, and origin location.
  • Index(es):
    • Date
    • Thread