FROM : Uli Kusterer
DATE : Sat Jan 19 12:28:22 2008
On 19.01.2008, at 09:02, Jaime Magiera wrote:
> - (IBAction) updateSubview:(id) sender
> {
> [currentSubview removeFromSuperview];
> currentSubview = subViewX // use some logic, index, etc. to
> determine the next desired subview, and copy it to the
> currentSubview variable
> [mainBox addSubview];
> }
Don't forget to retain the subviews. Adding a view to a superview
retains it, and removing it again releases it, so if you want to
remove a subview from one view and add it to another, you may want to
[[myView retain] autorelease] it to make sure it doesn't get disposed
before you've re-added it.
All that is of course is only necessary if you haven't otherwise
retained the view already, and only if you're running non-GC.
Cheers,
-- M. Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
DATE : Sat Jan 19 12:28:22 2008
On 19.01.2008, at 09:02, Jaime Magiera wrote:
> - (IBAction) updateSubview:(id) sender
> {
> [currentSubview removeFromSuperview];
> currentSubview = subViewX // use some logic, index, etc. to
> determine the next desired subview, and copy it to the
> currentSubview variable
> [mainBox addSubview];
> }
Don't forget to retain the subviews. Adding a view to a superview
retains it, and removing it again releases it, so if you want to
remove a subview from one view and add it to another, you may want to
[[myView retain] autorelease] it to make sure it doesn't get disposed
before you've re-added it.
All that is of course is only necessary if you haven't otherwise
retained the view already, and only if you're running non-GC.
Cheers,
-- M. Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
| Related mails | Author | Date |
|---|---|---|
| Philip Bridson | Jan 19, 05:32 | |
| Kyle Sluder | Jan 19, 07:04 | |
| Jaime Magiera | Jan 19, 09:02 | |
| Uli Kusterer | Jan 19, 12:28 |






Cocoa mail archive

