Re: Making views disappear and reappear
Re: Making views disappear and reappear
- Subject: Re: Making views disappear and reappear
- From: Peter Ammon <email@hidden>
- Date: Mon, 25 Jun 2001 09:56:43 -0700
on 6/23/01 12:58 PM, Mark T at email@hidden wrote:
>
I'm still relatively new to cocoa programming so please excuse me if
>
this question has an simple or obvious answer.
>
>
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];
>
>
This caused no visual change(the table still looked like it was
>
there), but you could no longer click on the table or interact with
>
it in any way. Trying to reverse this situation with addSubview had
>
no effect.
>
>
Any tips or code snippets would be much appreciated.
>
One technique I use to show or hide views is to put them in an NSBox and set
the frame of the box to something very small when they need to be hidden.
It works particularly well when I need to show or hide multiple views; e.g.
I have a row of NSColorWells, and clicking a NSStepper seems to make more
wells appear or disappear, where all that's really happening is that the
containing box's frame is getting bigger.
-Peter