Weak Variables

Sometimes you set up a relationship between two objects where each object needs to reference the other. (This could be as simple as two objects or as complex as a chain of objects that create a cycle.) For example, iOS applications present graphics on the screen through objects known as views. Views are maintained in a hierarchy. So one view might present an image, and inside that image view you might want to display a title for that image. You can set this up where the image view is the main view, and the title is a subview. When the main view is shown, the subview is automatically shown as well. You can think of the main image view as the parent view and the title view as the child view. The main image view owns the subview. ...

Get Programming in Objective-C, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.