Silver Challenge conceptual question


At this point, I realize (by looking at the other topics about the silver challenge) that the way to solve it involves creating IBOutlets for the subviews and setting the autoresizemasks on them. However, in general, what is the precedence between the settings in the xib and in code? Does the code always override the xib settings? Or vice versa? In order to do due diligence to this exercise, should I reset the xib based auto reset mask settings to defaults and then do it programmatically? Is there a way to say in the xib that I don’t want to configure auto reset mask settings there since I am doing it programmatically?

Update: I verified that in this case, the code does override the xib. Is that a strict general rule (that code always overrides what is in the xib)?



I don’t think it’s a matter of one having precedence over the other. When the object is “archived” in the XIB file, there is a property called autoresizingMask. You can set it to 0, but it’s still a value. So I don’t see the logic of having an XIB setting for “don’t want to configure auto reset [sic] mask”. When the XIB is loaded (initWithNibName:Bundle:), the instantiated object has the property and is set to whatever value was the XIB file. After the object is instantiated, anything you do programmatically to that property will “override” the XIB setting. So it’s not a matter of a rule or precedence. It’s a matter of when, in the object lifecycle, the property value is changed.