mru*_*ueg 3 ruby syntax objective-c
在Ruby中,当引用类"String"的"downcase"方法时,我编写了String#downcase.在谈论"新"类方法时,我写了String.new.
Objective-C有类似的东西吗?
Bar*_*ark 12
给出这样的类声明
@interface MyClass (NSObject)
{}
+ (id)classMethod;
- (id)instanceMethod;
@end
Run Code Online (Sandbox Code Playgroud)
通常的做法是指classMethod作为+[MyClass classMethod]或更紧凑+classMethod如果类是明确的.同样,我要提到instanceMethod的-[MyClass instanceMethod]或-instanceMethod.
| 归档时间: |
|
| 查看次数: |
288 次 |
| 最近记录: |