这可能吗?
举一个具体的例子,考虑以下宏:
define pos
po ([self $arg0])
end
所以现在如果我输入 pos 文本,它就会变成 po [self text]。但如果有多个参数,它会失败,例如 pos textLabel 文本变成 po [self textLabel] 而不是所需的 po [[self textLabel]text]。
再举一个例子,就像三个命令
po someIvar_
po [self someMethod]
po [[self someMethod]someOtherMethod]
打印出引用的三个对象的描述,最好定义一个对整数执行相同操作的宏 pi,即
pi [self someMethod]
和调用一样
print (int)[self someMethod],
同样对于
pi [[self someMethod]someOtherMethod].