Re: Creating WebView in code
Re: Creating WebView in code
- Subject: Re: Creating WebView in code
- From: Nick Zitzmann <email@hidden>
- Date: Wed, 31 Mar 2010 11:04:00 -0600
On Mar 30, 2010, at 11:53 PM, Jenny M wrote:
>>> Is it possible I could create it in a xib file and keep it invisible,
>>> and handle closing programmatically so it's not a waste of memory?
>>
>> Yes.
>
> Okay... how? I can uncheck "visible at launch," then how do I control
> the visibility and memory for that window via code?
For visibility, once you've unchecked visible at launch, then you are in total control of the window's visibility. Just don't order it into visibility by using something like -makeKeyAndOrderFront: or -[NSApplication runModalForWindow:] or something, and it will be present but invisible.
Managing the memory of views loaded from nibs is somewhat easier with the NSView/WindowController classes, since they will manage the nib memory for you. Normally if you load a nib using the methods in NSBundle, you are also responsible for releasing its top level objects, but NSView/WindowController does this for you when they are deallocated.
> I looked at initWithFrame, which looked to be my only way to open a
> webview completely programmatically, but then I'm not sure what the
> NSRect should be. I'll be printing so is there an NSRect I can grab
> from NSSharedPrintInfo somewhere??
Not an NSRect, but you can get an NSSize from [[NSPrintInfo sharedPrintInfo] paperSize]. From that, you can build an NSRect with that value for the size and NSZeroPoint for the origin.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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