• 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
Re: Repositioning a content view w/in a window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Repositioning a content view w/in a window


  • Subject: Re: Repositioning a content view w/in a window
  • From: "R.L. Grigg" <email@hidden>
  • Date: Mon, 28 Jul 2008 16:02:03 -0700

On Jul 28, 2008, at 3:54 PM, Erik Buck wrote:

Is something like this a decent Cocoa approach:

   // create the window
   myWindow = [[NSWindow alloc] initWithContentRect: ... ];
   // insert the existing matrix as it's content view
   [myWindow setContentView:myMatrix];
   // alter the position of the matrix
   NSPoint newPoint = ...
   [myMatrix setFrameOrigin:newPoint];
   [myWindow display];

No.

You want

   // create the window
   myWindow = [[NSWindow alloc] initWithContentRect: ... ];
   // insert the existing matrix as it's content view

   //************* See here!
   [[myWindow contentView] addSubview:myMatrix];

   // alter the position of the matrix
   NSPoint newPoint = ...
   [myMatrix setFrameOrigin:newPoint];
   [myWindow display];

A window's content view always fills the whole content area. Therefore, "moving it around" makes no sense.

Gotcha! Thats the nuance I wasnt picking up on, that the NSWindow has its default content view, and I just need to add my subview to _it_. Most excellent!


Thx!
Russ

_______________________________________________

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


References: 
 >Re: Repositioning a content view w/in a window (From: Erik Buck <email@hidden>)

  • Prev by Date: Re: [Newbie] Communication between two Views?
  • Next by Date: Re: Setting conditional breakpoint on Cocoa method?
  • Previous by thread: Re: Repositioning a content view w/in a window
  • Next by thread: QTKit Error loading DesktopVideoOut.component
  • Index(es):
    • Date
    • Thread