Can someone explain this @synthesize syntax?

前端 未结 2 1055
[愿得一人]
[愿得一人] 2020-12-11 12:01

I\'m following the example Navigation View template with core data in the latest iOS SDK.

In the rootViewController.m file I see this in the @synthesize

2条回答
  •  失恋的感觉
    2020-12-11 12:45

    Only the first one (on the lhs of the synthesize statement) is synthesized with a getter and setter and becomes the "public" instance variable.

    The latter (with the underscore) is still available inside the instance but is not exposed outside the instance. They both reference the same memory address.

提交回复
热议问题