这是我的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
@class Exercise;
@interface Question : NSManagedObject
@property (nonatomic, retain) NSNumber * aID;
@property (nonatomic, retain) id jsAnswer;
@property (nonatomic, retain) Exercise *exercise;
@end
这些课程由coredata
创建
如何在每次练习中通过Question
获取所有listQuestion
个对象
答案 0 :(得分:4)
这将为您提供给定练习的所有Question对象的数组:
NSArray *questions = [[exercise listQuestion] allObjects];