I’m new to iOS development and I was wondering if it is at all possible to access a UIView from within a UIView.
My current setup is that I have a main UIViewController with a UIView. Within that UIView I have a smaller UIView which I use to display debugging information. What I’d like to do is to be able to somehow access that view so that I can either see/hide it when I need to or even change the background color if I am trying to debug a logic error.
I have tried to access it using self.view, but that just gives me the parent view. I’ve seen on various sites and tutorials that I need to add it into a subView and work from there, but when I do that the view is set as 0x0. I also saw that I need to use IBOutlet and in the IB I need to reference it somewhere, but I have no clue how to do that as I do not see my object, that I defined in my controller’s header file, anywhere in the IB.
Any advice would be greatly appreciated.
If you want to access your second UIView through IB:
@property (nonatomic, retain) IBOutlet UIView *myView(of course, synthesize it)self.myView(if everything’s correct, it will have non-nil value)