Re: How do I prevent initWithFrame (NSView) being called?
Re: How do I prevent initWithFrame (NSView) being called?
- Subject: Re: How do I prevent initWithFrame (NSView) being called?
- From: Aram Greenman <email@hidden>
- Date: Sun, 23 Jun 2002 17:37:07 -0700
On Sunday, June 23, 2002, at 04:30 PM, Hisaoki Nishida wrote:
Like you suggested, I implemented an awakeFromNib method in my custom
window class.
But the initWithFrame method would be called anyway, even if I go
full-screen.
I think I wasn't clear -- you should implement -awakeFromNib in your
controller, not your custom view. The window and view should be in a
separate nib file which is only loaded if you read the user defaults and
determine it is going to be used.
If you have an NSView in a nib file, -initWithFrame: will be sent to the
view when it is loaded, no way around it. And overriding -initWithFrame:
with an implementation that doesn't [super initWithFrame:] is not a good
idea for obvious reasons.
- but, since what you want to do is not create a window at all for
full-screen mode, then the -awakeFromNib: method which reads the user
defaults should belong to a controller, not the custom view. If the user
wants full-screen mode, set your context to full screen, if they want a
window, load the window's nib file and assign the context to the view in
that window.
I don't know where you are creating your context, but since it will
sometimes live in a view and sometimes in full screen mode, then the
context should be created independent of your custom view class.
aram
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.