My question relates to Assignment 3 in CS193p.
Im having a terrible time getting drawRect
in my View to receive information passed from my View Controller. Basically, my goal is to pass view-specific information (like self.view.size.width
) to the controller, have it make some modifications (like result = self.view.size.width * 2
), and pass result
back to drawRect
so that it could take the new info and draw it. Im pretty sure I have my delegation set up correctly, and really have tried a list of potential work-arounds:
make a public View
@property
, which I access in mycontroller.m
viaView *newView someResult = newView.variable
which I would then try to access from my view.m
via
self.variable
- use methods set in my View's
@protocal
, which I try to pass data viamyView.dataSource someMethod:someData
But so far none of these are currently working (i.e. my self.variable
would always come out to be 0, which shows that no data was passed to it). Your help much appreciated!
UPDATE:
The culprit was that, in the storyboard, I didn't control-drag the View Controller to the View, and hence the Controller was never connected... but at least now it works. ^_^