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

Using PHP to write a CSV file with Spanish characters

php csv utf-8

I have a php script with utf-8 encoding. In it I have an array with special characters (like and n with a ~ on top). It looks just fine in my editor. The php matches the array with text coming in f...

Give route and time of Api Google Maps

android google-maps-api-3

I wonder if with the Google Maps API I can trace a route between two points, taking the distance and time to go, as well as Maps Android application, if anyone has an example of how to do, I am gra...