Re:[cocoa-dev] How can I hide an NSView properly?
Re:[cocoa-dev] How can I hide an NSView properly?
- Subject: Re:[cocoa-dev] How can I hide an NSView properly?
- From: Michael McCracken <email@hidden>
- Date: Thu, 28 Feb 2002 08:25:33 -0800
Gerben,
I have done what you're describing by creating an invisible (no border)
NSBox in IB, and changing its content view to the NSView (in my case,
NSTableView swapping off with NSOutlineView) by using the NSBox's
setContentView: - described from the AppKit docs below:
- (void)setContentView:(NSView *)aView
Sets the receiver's content view to aView, resizing the NSView to fit
within the box's current content area. The box is marked for redisplay.
It seems like this would handle your resizing concern.
I think i got this idea from a sample app or a book somewhere, so it
might be the standard way. I'd be interested to know if what I've
described is bad for some reason or another... anyone?
-michael
On Thursday, February 28, 2002, at 07:35 AM, cocoa-dev-
email@hidden wrote:
From: Gerben Wierda <email@hidden>
To: email@hidden, email@hidden
I have some NSViews (in fact NSProgressIndicators) that I want to
hide/unhide as they must temporarily take the place of other display
items. What I came up with is this:
In owner of nib file init:
Store the superview
[retain the indicator]
In owner of nib file dealloc:
[release the indicator]
For hiding (this releases the indicator, hence the init retains):
[[indicator retain] removeFromSuperviewWithoutNeedingDisplay]
For unhiding (this retains the indicators):
[superView addSubView:[indicator release]];
This will probably work, but I think this fails when the superview is
resized when the indicator is hidden. So this method will probably mean
that I have to give up on a resizable window (or do a lot of
calculation).
I haven't been able to find hide/unhide methods for views (or even
controls). Am I overlooking something?
Thanks,
G
--
Michael McCracken
email@hidden
_______________________________________________
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.