Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
I have a UIView named Alice. Alice has an image view named Bob. Bob is connected to Alice via an IBOutlet. Sometime immediately after Bob is initialized, Alice will need to set his "hidden" property. I can override Alice's addSubview method and check to see if Bob is the view to be added, and if he is, set view's hidden property to true. However, is there another way to do what I want without manually registering Alice as an observer?
 
I have a UIView named Alice. Alice has an image view named Bob. Bob is connected to Alice via an IBOutlet. Sometime immediately after Bob is initialized, Alice will need to set his "hidden" property. I can override Alice's addSubview method and check to see if Bob is the view to be added, and if he is, set view's hidden property to true. However, is there another way to do what I want without manually registering Alice as an observer?
Doesn't your question depend on the if clause
That clause determines if Bob ought to be hidden or not
 
I'm not sure what you want to do, but I have an app in the Store which does something similar.

What I needed to do was have a simple single view app with two views. Ok what I did was stack two views on top of each other. Both views get initialized through one view controller and the top view is hidden under two basic conditions. The first is the initial opening of the app when user data is required to be added. The second is when the user wants to change his or her data, which is done by selecting a menu bar item.

One thing I noticed is you put your "outlet" for bob in the UIView class. Normally I would think this is not the suggested way of doing things. Wouldn't it make more sense to use you view controller for all the actions and outlet work? Most views have multiple types of views within them.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.