How can I check that every outlet actually points to some view?
How can I check that every outlet actually points to some view ? How can I manually set the index of the object in Interface Builder ? we discussed in previous topic There is a problem when i am getting index of开发者_高级运维 subview
i checked my outlet
If it's nil it's not correctly attached. i.e.
if (nil == distanceTextField)
NSLog(@"distanceTextField not attached.");
However, just because an outlet is attached doesn't mean that it's definitely a subview of anything :)
If you get a low memory warning then your controller will release all of it's views. This will remove them from the ui but won't remove them from the outlet unless you tell it to :)
It's perfectly possible to get the situation where distanceTextField is not nil but distanceTextField.superview is nil.
Also, just because you have created a controller doesn't mean that it's created all of it's views yet - it will wait until the last minute to create them to save memory / speed up loading etc.
You will get nil for your outlets until viewDidLoad has been called inside your controller.
精彩评论