Tôi đã nhận thấy một loạt các khai báo @interface
cho các lớp Objective-c. Tôi muốn hiểu tại sao các nhà phát triển tuyên bố @interface
theo các cách sau:Các loại khai báo @interface, một số có dấu ngoặc đơn
// 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
Ví dụ: [tìm kiếm nhanh] (http://stackoverflow.com/search?q=%5Bobjc%5D+%40interface+parentheses&submit=search) lần lượt lên http : //stackoverflow.com/questions/7378479/what-does-the-text-inside-parentheses-in-interface-and-implementation-directive –
Còn xem xét [spec ngôn ngữ] (http://developer.apple .com/library/mac/documentation/Ca cao/Khái niệm/Mục tiêuC/Chương/ocDefiningClasses.html # // apple_ref/doc/uid/TP30001163-CH12-SW1)? –