Objective-C 方法类型限定

来源:互联网 发布:怎么添加网络磁盘 编辑:程序博客网 时间:2024/05/22 18:21
  • in: argument is an input argument only and won’t be referenced later
  • out: argument is an output argument only, used to return a value by reference
  • inout: argument is both an input and output argument
  • const: the (pointer) argument is constant
  • bycopy: instead of using a proxy/NSDistantObject, pass or return a copy of the object
  • byref: use a proxy object (default)
  • oneway: is used with the distributed objects API, which allows use of objective-c objects between different threads or applications. It tells the system that it should not block the calling thread until the method returns. Without it, the caller will block, even though the method's return type is void. Obviously, it is never used with anything other than void, as doing so would mean the method returns something, but the caller doesn't get it. 

参考:
http://objc.toodarkpark.net/moreobjc.html
http://stackoverflow.com/questions/5609564/objective-c-in-out-inout-byref-byval-and-so-on-what-are-they