Zauważyłem wiele deklaracji @interface
dla klas Objective-c. Chciałbym zrozumieć, dlaczego deweloperzy deklarują @interface
w jeden z następujących sposobów:Odmiany deklaracji @interface, niektóre z nawiasami
// in the .h file
@interface MyClass : NSObject
// ...
@end
// in the .m file (what's the purpose of the parens?)
@interface MyClass()
// more property declarations which seem like they can go in the .h file
@end
// again in the .m file (what's the purpose of private?)
@interface MyClass (Private)
// some method declarations
@end
Na przykład: [szybkie wyszukiwanie] (http://stackoverflow.com/search?q=%5Bobjc%5D+%40interface+parentheses&submit=search) podkręca http : //stackoverflow.com/questions/7378479/what-does-the-text-inside-parentheses-in-interface-and-implementation-directive –
Co powiesz na [specyfikację językową] (http://developer.apple) .com/biblioteka/mac/documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocDefiningClasses.html # // apple_ref/doc/uid/TP30001163-CH12-SW1)? –