Single object, multiple IBOutlets

I've found discussion of dealing with a single IBOutlet and multiple objects but what about the reverse? I have a single object I want to assign multiple IBOutlets to, are there any pitfalls there especially around releasing the IBOutlets in dealloc/viewDidUnload?

EDIT: For example...

I have a ViewController class that uses a different XIB for iPad and iPhone (its a custom CameraView controller). Now on the iPhone there are 2 different labels for zoomLevel and videoDuration, on the iPad I use the same label for both, so in the iPad XIB I'd like to point the two IBOutlets to the same UILabel.

Answers


I believe each outlet assigned to the object would raise the retain count by 1, and as you set the outlets to nil when the view unloads the count would be decremented by 1 each time, so it should work

Since you have to reinitialize properties each time the view is displayed I would say a pitfall is the view display logic has been removed from the XIB and put into your code. I would say the severity of this is subject to personal opinion and how religious you want to maintain the MVC relationship.


Need Your Help

Lost a Control on a WinForm

winforms visual-studio-2008 c#-3.0 control

I've been recursively refining a UI with visual Studio 2008, and I seem to have lost a control underneath the myriad layers of other controls. the project is checked into our version control softwa...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.