更新时间:2022-12-24 08:46:57
如果你想定义一个全局变量,它(在@implementation的内部或外部)。在这个上下文中, static
表示该变量只能在此编译单元(.m文件)中可见。
If you want to define a global variable, it does not matter where you put it (inside or outside of @implementation). In this context, static
means that the variable is only visible from within this compilation unit (.m file).
还有静态变量,它们在函数中定义。它们的工作方式类似于全局变量,但仅在函数的作用域内可见。
There are also static variables, which are defined in functions. They work like global variables, but are visible only from within the function's scope.