• 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: Embedding Custom NSView in an NSWindow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Embedding Custom NSView in an NSWindow


  • Subject: Re: Embedding Custom NSView in an NSWindow
  • From: Robert Spychala <email@hidden>
  • Date: Wed, 30 Nov 2005 00:15:42 -0500

the problem was solved by essentially doing something like:

- (void)awakeFromNib
{
	[[nswin contentView] addSubview:nsview];
}

thanks for the tip!

What is the proper way to addSubview without creating a new one, but rather using the one that was created in IB?

It seems that IB creates a CustomView but it doesn't put the NSView in it. If that is true, then is the CustomView in IB only to be used when you want to programatically draw your own stuff by overriding the drawRect method?

r.S.

On Nov 29, 2005, at 6:06 AM, John C. Randolph wrote:


On Nov 26, 2005, at 5:48 PM, Robert Spychala wrote:

Hi,

I want to embed a custom NSView subclass (with some widgets in it) into a NSWindow but it's not doing what id like it to to. Everything works ok with a class like WebView when i finish http:// cocoadevcentral.com/articles/000077.php, but not with a Custom View.

If you subclass NSView, you have to implement -drawRect:, or it won't draw anything. If you want it to have subviews, you can't just drop them on a CustomView in IB, you have to send -addSubview: messages.


-jcr


John C. Randolph <email@hidden> (408) 914-0013 Roaming Cocoa Engineer, Available for your projects at great Expense and Inconvenience.




Robert Spychala Voice: 1-718-218-8929 Email: email@hidden Fax: 1-919-493-3299

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Embedding Custom NSView in an NSWindow (From: Robert Spychala <email@hidden>)
 >Re: Embedding Custom NSView in an NSWindow (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: Is Apple's singleton sample code correct?
  • Next by Date: RE: Is Apple's singleton sample code correct?
  • Previous by thread: Re: Embedding Custom NSView in an NSWindow
  • Next by thread: NSDate without time component
  • Index(es):
    • Date
    • Thread