Reputation: 1245
I have a bunch of outlets in a controller object that another controller needs to be passed. If it was only 2 or 3 values, I'd just pass them as parameters to the delegate method (not directly the outlets, but by copying the value to variables)
However, there are quite a few. What is the best way to handle this? I see three approaches:
I could create a new object that holds all these properties and pass that.
I could just pass the controller in the delegate method [self.delegate didClickDone:self]
. The problem with this approach is this: am I allowed to access another controller's outlets from the outside?
I could follow the 2nd option but copy every outlet's value to a property and allow the other controller to access them via accessor methods.
What is the best way to approach this?
Upvotes: 0
Views: 412
Reputation: 47241
You are always allowed to do what you allow yourself. However some approaches may prevent Apple from accepting your App for the Appstore. This is not the case here ;)
If there are many values to pass I'd go for
The dirty way would be, as you suggested, to open the Outlets to other instances than the view controller itself. Prevent that nosy behaviour of other classes.
Upvotes: 1