Objective c 在UITableView行部分中使用索引值
我有两个实体类: 模块hObjective c 在UITableView行部分中使用索引值,objective-c,xcode,uitableview,nsmutablearray,rows,Objective C,Xcode,Uitableview,Nsmutablearray,Rows,我有两个实体类: 模块h @interface Module : NSObject { NSString *moduleCode4; NSString *moduleTitle4; NSString *credits4; NSString *semester4; NSMutableArray *assessmentDetails4; } 评估详情 @interface AssessmentDetail : NSObject { NSStrin
@interface Module : NSObject {
NSString *moduleCode4;
NSString *moduleTitle4;
NSString *credits4;
NSString *semester4;
NSMutableArray *assessmentDetails4;
}
评估详情
@interface AssessmentDetail : NSObject {
NSString *assessmentName4;
NSString *assessmentType4;
NSString *assessmentWeighting4;
NSString *assessmentDueDate4;
}
我已经在NSMutableArray中填充了这些类
在我的表视图中,我有:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
GradeToolAppDelegate * appDelegate = [UIApplication sharedApplication].delegate;
return [appDelegate.modules4 count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
// The header for the section is the region name -- get this from the region at the section index.
GradeToolAppDelegate * appDelegate = [UIApplication sharedApplication].delegate;
Module *aModule = [appDelegate.modules4 objectAtIndex:section];
return [aModule moduleCode4];
}
我的问题是我需要节的模块索引中的索引行路径
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
GradeToolAppDelegate * appDelegate = [UIApplication sharedApplication].delegate;
//Module *aModule = [appDelegate.modules4];
AssessmentDetail *anAssess = [module.assessmentDetails4 objectAtIndex:section];
return [anAssess count];
}
我不明白如何从该部分获得评估数量,有人能帮我吗
非常感谢。您已经在tableView:TitleForHeaderin部分中看到了大部分内容:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
GradeToolAppDelegate * appDelegate = [UIApplication sharedApplication].delegate;
Module *aModule = [appDelegate.modules4 objectAtIndex:section];
return [aModule.assessmentDetails4 count];
}