Really best practice to retain IBOutlet view elements?
<p>I keep running into situations with UIViewControllers containing a large amount of IBOutlets connecting the controller to its view's subviews (typically UILabels). </p>

<p>Following "best practices", i.e. use retain on all UI elements: <code>@property (retain, nonatomic) UILabel *theElement1</code>, <code>@property (retain, nonatomic) UILabel *theElement2</code>, ...  gives me insane amounts of boiler plate code in <code>dealloc</code> and <code>viewDidUnload</code> for the view controller. </p>

<p>The offending IBOutlets are never used nor set outside the UIViewController (the set-method is only used in viewDidUnload and when the nib is loaded) except automatically when the nib is loaded.</p>

<p>The result from "best practice" is:</p>

<ul>
<li><code>dealloc</code> littered with <code>[theElement1 release]</code>, <code>[theElement2 release]</code> etc.</li>
<li><code>viewDidUnload</code> with <code>[self setTheElement1:nil]</code>, <code>[self setTheElement2:nil]</code> etc.</li>
</ul>

<p>However, since all of those elements are known to be retained by the view anyway, and the view is released by the UIViewController at appropriate times, I see <strong><em>absolutely no reason whatsoever</em></strong> for me to manually manage this.</p>

<p>The reason for this particular "best practice" (as far as I can tell) is to be consistent with your retains. But once you start having a large amount of outlets, you're more likely to miss handling the some outlet somewhere in either of the two methods, than you'll have trouble correctly changing outlets to "retain" for those special outlets you really want to retain even after the view is goodbye.</p>

<p>Is there some reason for this "best practice" other than the one I know about or should I feel quite free to break this "rule" in the particular case of subviews to an UIViewController's view?</p>
