DataController.h兩個接口?
@class Play;
@interface DataController : NSObject
- (unsigned)countOfList;
- (Play *)objectInListAtIndex:(unsigned)theIndex;
@end
DataController.m
#import "DataController.h"
#import "Play.h"
@interface DataController()
@property (nonatomic, copy, readwrite) NSMutableArray *list;
- (void)createDemoData;
@end
@implementation DataController
@synthesize list;
- (id)init {
if (self = [super init]) {
[self createDemoData];
}
return self;
}
爲什麼你認爲@interface被定義了兩次?還有什麼()的含義?不應該有一個類名稱,也許是括號之間的超類?
見http://stackoverflow.com/questions/862299/how- do-a-category-work-in-objective-c – XJones 2011-12-31 00:01:11