Nav*_*eed 18
在对象上调用方法的基本语法是:
[object method];
[object methodWithInput:input];
Run Code Online (Sandbox Code Playgroud)
如果方法返回值:
output = [object methodWithOutput];
output = [object methodWithInputAndOutput:input];
Run Code Online (Sandbox Code Playgroud)
编辑:
这是一个很好的例子,说明如何从其他类调用方法:
例:
SomeClass* object = [[SomeClass alloc] init]; // Create an instance of SomeClass
[object someMethod]; // Send the someMethod message
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27863 次 |
| 最近记录: |