March 2014
Intermediate to advanced
672 pages
40h 11m
English
Using a named view approach allows you to retrieve subviews without having to declare IBOutlet instance variables. (Whether this is a net benefit to code readability and maintainability is beyond the scope of this section.) Consider the code you saw earlier in this section that toggles a switch from within an interface. You can add that name (Ignition Switch) as a custom runtime attribute in IB.
Figure 4-3 shows how you do this. Select any view and open the Identity Inspector (View > Utilities > Show Identity Inspector). Locate the User Defined Runtime Attributes section and click + to add a new attribute. Set the Key Path to nametag (to match the property defined in Recipe 4-3’s UIView class category), Type ...
Read now
Unlock full access