If I want to manipulate a view I get it with
[self viewWithTag:5];
. Is there a better way to do this?Sometimes I need to manipulate a bunch of view (e.g. move them all out of the way. I do this by adding a UIView (e.g. UIView iHoldViews) and then adding the views, buttons, etc to this view. Then I can move the iHoldViews view and all its subviews move with it. Is there a better way to do this? (I have a feeling there is :) Maybe storing them in a NSArray or NSMutableDictionary ?
views:
33answers:
1
+1
A:
For views you need frequently, it is recommended to have ivars for them. Wire them up in InterfaceBuilder or in code.
Both ways (via a view or a collection) are possible. If they are visually grouped, I'd use a UIView, if they build different units that just happen to be moved together, a collection would make more sense. Non-opaque views have a performance hit, so this might be a consideration if you have evidence that you are too slow.
Eiko
2010-06-06 10:42:17
Sometimes items in this UIView do not respond to touches properly. eg. I have UITextView in this view and it does not respond to touches like it should. Do you know how to fix this?
david
2010-06-06 11:17:09
This sounds like a different problem. As long as your views are correctly sized and not covered by other views, they should work as expected.
Eiko
2010-06-06 11:45:11
D'oh thanks. :)
david
2010-06-06 12:01:22