尝试:
perform: aSymbol
perform: aSymbol with: anObject
perform: aSymbol withArguments: anArrayOfArguments
Run Code Online (Sandbox Code Playgroud)
其中aSymbol是您的方法选择器.例如,而不是1 + 2你可以写:
1 perform: #+ with: 2
Run Code Online (Sandbox Code Playgroud)
如果您的方法选择器存储为a String,则必须将其转换为Symbol第一个:
1 perform: '+' asSymbol with: 2
5 perform: 'raisedTo:modulo:' asSymbol withArguments: #(2 3)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
319 次 |
| 最近记录: |