我注意到Objective-c類的各種@interface
聲明。我想知道爲什麼開發商申報@interface
在以下幾個方面:各種@interface聲明,有些用括號
// 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
例如:[快速搜索(http://stackoverflow.com/search?q=%5Bobjc%5D+%40interface+parentheses&submit=search)變成了HTTP ://stackoverflow.com/questions/7378479/what-does-the-text-inside-parentheses-in-interface-and-implementation-directive –
看看[language spec]怎麼樣(http://developer.apple .COM /庫/ MAC /文檔/可可/概念/的ObjectiveC /章節/ ocDefiningClasses.html#// apple_ref/DOC/UID/TP30001163-CH12-SW1)? –