何时何地声明@property? (目标C)

时间:2021-04-01 22:49:40

Sometimes its done in the header file, sometimes its done in the implementation. I'm fairly new to programming. Could someone briefly explain when to do which?

有时它在头文件中完成,有时它在实现中完成。我对编程很新。有人可以简要解释什么时候做?

1 个解决方案

#1


3  

When it's meant for other classes, put it in the header. When it's just meant for that class, put it in a class extension in the implementation file.

如果它适用于其他类,请将其放在标题中。当它仅适用于该类时,将其放在实现文件中的类扩展中。

#1


3  

When it's meant for other classes, put it in the header. When it's just meant for that class, put it in a class extension in the implementation file.

如果它适用于其他类,请将其放在标题中。当它仅适用于该类时,将其放在实现文件中的类扩展中。