Re: Making views disappear and reappear
Re: Making views disappear and reappear
- Subject: Re: Making views disappear and reappear
- From: Carlos Weber <email@hidden>
- Date: Sat, 23 Jun 2001 11:27:43 -1000
On Saturday, June 23, 2001, at 09:58 , Mark T wrote:
>
I'm trying to make a TableView disappear and reappear in response to a
>
user clicking a button. I was going to use removeFromSuperview, but it
>
says to not invoke it during display. So I tried using
>
>
[[self myTable] retain];
>
[[self myTable] removeFromSuperviewWithoutNeedingDisplay];
When the docs say, "Never invoke this method during display.", I think
the meaning is that you should not call this from a -drawRect: routine
or when doing direct drawing to a view (in between -lockFocus and
-unlockFocus). I'm prepared to be enlightened on this if I am mistaken.
I believe the following should work:
NSView *itsSuperview = [[self myTable]superview];
NSRect rectToRedraw = [[self myTable]frame];
// ...
[[self myTable] retain];
[[self myTable]removeFromSuperview];
[itsSuperview setNeedsDisplayInRect: rectToRedraw];