1

これは私のExerciseクラスです

@class Question;

@interface Exercise : NSManagedObject

@property (nonatomic, retain) NSNumber * aID;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSSet *listQuestion;
@end

@interface Exercise (CoreDataGeneratedAccessors)

- (void)addListQuestionObject:(Question *)value;
- (void)removeListQuestionObject:(Question *)value;
- (void)addListQuestion:(NSSet *)values;
- (void)removeListQuestion:(NSSet *)values;

@end 

そしてここにQuestionクラスがあります

@class Exercise;

@interface Question : NSManagedObject

@property (nonatomic, retain) NSNumber * aID;
@property (nonatomic, retain) id jsAnswer;
@property (nonatomic, retain) Exercise *exercise;

@end

これらのクラスは coredata によって作成されました 各演習ですべてのオブジェクト
を取得するにはどうすればよいですかQuestionlistQuestion

4

1 に答える 1

4

これにより、特定の演習のすべての Question オブジェクトの配列が得られます。

NSArray *questions = [[exercise listQuestion] allObjects];
于 2012-05-26T11:29:46.307 に答える