且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Objective C中是否有两种方法来声明实例变量?

更新时间:2022-12-25 08:50:25

它们在功能上是等效的.在ObjC 2.0中,如果您未在 synthesize 语句中指定一个,则 synthesize 关键字将自动创建关联的ivar.所有现代运行时都具有此功能.

They are functionally equivalent. In ObjC 2.0 the synthesize keyword will automatically create the associated ivar if you do not specify one as part of the synthesize statement. This functionality is present on all modern runtimes.