Re: Seeking advice on best practice for managing visibility of many subviews
Re: Seeking advice on best practice for managing visibility of many subviews
- Subject: Re: Seeking advice on best practice for managing visibility of many subviews
- From: WT <email@hidden>
- Date: Thu, 2 Apr 2009 08:02:25 +0200
From the perspective of efficiency, I speculate that hiding/showing
views would be a better approach, given that adding/removing subviews
has to traverse and manipulate the view hierarchy, which could be
potentially an expensive proposition (unless all the subviews are
siblings of one superview and the hierarchy is very shallow). Only
profiling the application can really tell for sure, however.
As far as your last question, the documentation for NSView and UIView
states that hidden subviews still participate in the view hierarchy
and contribute to autoresizing when the visible subviews are moved or
resized, though they do not respond to events and aren't visible.
On Apr 2, 2009, at 4:47 AM, Stuart Malin wrote:
I have a view that has hundreds of subviews. The user can control
filters which causes different of the subviews to be presented; the
collection of selected-for-presentation subviews are repositioned in
the super view. I can think of two ways to handle this, and am not
sure which is best:
1) remove and add subviews from the super view each time the filter
criteria changes, or
2) leave all views in the super view, and just use -setHidden: to
control whether presented or not.
If the second approach is a better practice, does it matter where
the hidden views are positioned?
TIA.
_______________________________________________
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
_______________________________________________
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