我想畫的行數根據他們在 守則,部分:無法獲取numberofRowsinSection?
-(void)configureView:(NSDictionary *)serverResult{
NSManagedObject * detailData = [serverResult valueForKey:@"details"];
NSSet * projID = [detailData valueForKey:@"PROJECTID"];
NSSet * projStat = [detailData valueForKey:@"PROJECTSTATUS"];
NSSet * appDate = [detailData valueForKey:@"BOARDAPPROVALDATE"];
NSSet * closeDate = [detailData valueForKey:@"LOANCLOSINGDATE"];
NSSet * countryName = [detailData valueForKey:@"COUNTRYNAME"];
NSSet * regionName = [detailData valueForKey:@"REGIONNAME"];
NSSet * envCatCode = [detailData valueForKey:@"ENVASSESMENTCATEGORYCODE"];
NSSet * teamLeader = [detailData valueForKey:@"TEAMMEMFULLNAME"];
NSSet * borrower = [detailData valueForKey:@"BORROWER"];
NSSet * impAgency = [detailData valueForKey:@"IMPAGENCY"];
NSSet * totalCost = [detailData valueForKey:@"LENDINGPROJECTCOST"];
NSSet * comtAmt = [detailData valueForKey:@"IBRDPLUSIDAAMT"];
basic = [NSArray arrayWithObjects:projID, projStat, appDate, closeDate,countryName,regionName,envCatCode,teamLeader,borrower,impAgency,totalCost,comtAmt, nil];
}
- (NSInteger)tableView:(UITableView *)tv numberOfRowsInSection:(NSInteger)section
{
int number;
switch (section) {
case 0:
number = basic.count;
break;
case 1:
number = allSectors.count;
break;
case 2:
number = 1;
break;
default:
break;
}
return number;
}
但是,代碼崩潰與EXC_BAD_ACCESS 請幫助!
它會崩潰在哪條線上? –
number = basic.count;其中basic是NSArray,table有3個部分。 – Ashutosh
您的basic.count和allSectors.count值是否正確?嘗試記錄它們或放入一箇中斷點。另外,給我們整個錯誤信息來幫助我們。 – sosborn