Tekkaman

导航

 

objc之method&class attributes】  

  Objective-C now supports some gcc attributes for Objective-C methods. Syntactically, attributes for a method follow the method's declaration, and attributes for a method parameter sit between the parameter type and the parameter name. Supported attributes include:

  Deprecation and availability, including AvailabilityMacros.h

  - (void)method:(id)param  __attribute__((deprecated));

  Unused parameters

  - (void)method:(id) __attribute__((unused)) param;

  Sentinel parameters, including NS_REQUIRES_NIL_TERMINATION

  - (void)methodWithObjects:(id)obj, ...  NS_REQUIRES_NIL_TERMINATION;

 

  Objective-C also supports some gcc attributes for Objective-C classes. Syntactically, attributes for a class precede the class's @interface declaration. Supported attributes include:

  Deprecation and availability, including AvailabilityMacros.h

  __attribute__((deprecated))

  @interface MyDeprecatedClass : SomeSuperclass

 

  Visibility

  __attribute__((visibility("hidden")))

  @interface MyPrivateClass : SomeSuperclass

posted on 2013-05-07 19:41  Tekkaman  阅读(284)  评论(0编辑  收藏  举报