Dot Notation

Introduced with Objective-C 2.0, dot notation provides a simple mechanism for accessing properties that have accessor methods. To get the value of a property, use this:

UIImage *image = self.myImage;

To set the value of a property, use this:

self.myString = @"Another string";

Dot notation can be strung together to simplify accessing or updating values for nested objects.

self.myView.myLabel.text = @"Label Title";

Note

ARC memory qualifiers set on properties do not protect against retain cycles. A retain cycle is when two objects have strong references to each other, and the compiler is never able to release them. An example of this is a delegate ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK 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.