Note that there are some explanatory texts on larger screens.

plurals
  1. PONib objects (subviews) accessing properties in ViewController
    primarykey
    data
    text
    <p>Edited for brevity: </p> <p><strong>How does a subview access properties in its superview and its superview's view controller?</strong> Easy enough to go down the chain. How do we go back up? </p> <p>Original (verbose) post:</p> <p>The immediate problem I'm trying to solve is simplifying the "birth" of a somewhat complex view. The large picture has to do with Nibs and how subclasses (of UIView in particular) that have beyond trivial initializers are reconstituted when the view loads. </p> <p>I have some custom UIViews - subviews of a subview of my viewcontroller's view. When I instantiate these views in particular they need a reference to some properties (NSNumberFormatter, &amp; NSDictionary) of the View Controller. </p> <p>Currenty I use a method to instantiate them:</p> <pre><code>- (id)initWithFrame:(CGRect)frame items:(NSDictionary *)dictionary forEditingMode:(EditingMode)mode </code></pre> <p>I'm experimenting with moving them into a Nib to let them reconstitute themselves and running into basic design issues. One being I think I'm limited to initWithFrame as the default initializer?!? If so how can these objects look into the parent view controller and get a reference to the dictionary and some other properties?</p> <p>Are there methods I could call within initWithFrame (similar to the ones that retrieve the UIApplication delegate) but would instead allow the child view to send methods to it's parent views and/or controllers? </p> <p>Send in the MVC police, I'm sure I'm breaking something...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload