I have an application where small number of objects are defined in the MainWindow. A pair of these objects are a UIViewController and the UIImageView that goes along with this controller. When the application starts up, the entire MainWindow.xib get loaded & I can see that this UIImageView has been loaded into memory. At this point, I have no need for this UIImageView.
When I need the UIViewController, I perform the usual alloc/init setup. At this point, when I look at this controller with the debugger, the controller is setup correctly, but the UIImageView that should have been pre-wired with Interface Builder is always nil.
Any suggegstions on how to make sure this UIImageView is loaded into memory correctly? This is the only case where I've had an issue with objects defined within this single MainWindow.xib file.Answer1:
Assuming you have connected the
view outlet, all you need to do is access the
view property. When you look in the debugger, you're seeing the property's corresponding ivar. When you access the property in code, it should load for you. So, it should be as simple as:
Not quite sure I understand the problem, but instead of having the UIImageView in MainWindow.xib, why not have it in the xxxViewController.xib where it's actually going to be needed?