I'm just trying to bow my head around MVC in Objective-C and IOS, but I have a problem. I hope someone can help me.
I created a custom view (created as a child UIView in XIB) that uses a simple delegate protocol to request information from my delegate in drawRect. I have a view controller that implements the protocol and connects to the view through the interface builder. The user view also has several properties that I want to set at startup. My problem is how the controller needs to access the view in order to set these properties, since it does not have direct access to it. Also, the properties do not seem visible in the inspector of the interface constructor, as I would expect, unlike the delegation property that I added.
At first I thought I could do something like
[self.view setViewIntProperty:10]
But this will be a call to the main XIB view, and my custom view is actually a child of this view, so I need to somehow get this child view so that I can initialize it from the controller in viewDidLoad.
I hope this is clear. I am sure that this should be easy, and I missed something simple, but I can’t understand how it works normally.
source
share