Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

grandM

macrumors 68000
Original poster
Oct 14, 2013
1,551
309
In doubt: I added a view B inside the main view of a ViewController C. Upon creating the outlets I connected them to the ViewController C. It is obvious the UIView outlet for view B ought to be placed in the ViewController C. But the outlets which are in view B should they be in ViewController C. Or should a new ViewController be added containing the outlets of view B?

Everything works by the way. I just want to know if I made a design mistake placing the outlets in the ViewController C.
 
There's no reason to add a child view controller just for the purpose of holding the outlets. In general the outlets will go in the owning view controller regardless of how deep the view hierarchy is. In some cases outlets would go in a parent view (not view controller). Properties in UITableViewCell are like this.
 
Oh thanks. So basically I do not need to add an extra ViewController. I did wonder if it wasn't a sign of better programming. Would have complicated matters though. I was already wondering how I would pass the property from the parent ViewController to the child ViewController. Would this be have been done with a protocol and delegate?
 
There's no reason to add a child view controller just for the purpose of holding the outlets. In general the outlets will go in the owning view controller regardless of how deep the view hierarchy is. In some cases outlets would go in a parent view (not view controller). Properties in UITableViewCell are like this.
Oh thanks. So basically I do not need to add an extra ViewController. I did wonder if it wasn't a sign of better programming. Would have complicated matters though. I was already wondering how I would pass the property from the parent ViewController to the child ViewController. Would this be have been done with a protocol and delegate?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.