호출하는 UITableView numberOfRowsInSection입니다. 그러나 cellForRowAtIndexPath는 호출되지 않습니다. cellForRowAtIndexPath가 호출되지 않은 이유를 모르겠습니다. 제가 iOS UITableView cellForRowAtIndexPath Not Calling
return [array count]+1;
if (allOfficedata.count >0) return [allOfficedata count] + 1;
가 cellforrowatindexpath 호출되지
return (allOfficedata.count >0)? allOfficedata.count + 1 : allOfficedata.count;
또는
부에 열의 번호를 retun 만약 대가 배열 주면 카운트; 또는 11을 반환; 그 작업을 잘 BELOVE 내가 인해 캐치되지 않는 예외 'NSRangeException'응용 프로그램 종료, 이유는 내 코드, 오류***** 첨부 : '* - [__ NSArrayM objectAtIndex :] : 범위를 넘는 인덱스 10 0. . 9] '
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView==self.LeftMenuTable)
return leftOptions.count;
return [allOfficedata count]+1;
}
**********************************************************************
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView==self.LeftMenuTable)
return 60;
Feedmodel *fmodel=[allOfficedata objectAtIndex:indexPath.row];
NSString *checkType = fmodel.achievementType;
if (isPad)
{
if (indexPath.row == 0)
{
return (isPad)?300.0:434.0;
}
else if (indexPath.row == allOfficedata.count+1)
{return 30.0;}
else{
if (![checkType isEqualToString:@""] || [checkType isEqualToString:@"0"] || [checkType isEqualToString:@"1"])
return ([fmodel.feedCommentCount integerValue] > 0)?366:318;
else
return ([fmodel.feedCommentCount integerValue] > 0)?249:200;
}
return 0.0;
}
else
{
if (indexPath.row == 0)
{
return (isPad)?232.0:434.0;
}
else
{
if (![checkType isEqualToString:@""] || [checkType isEqualToString:@"0"] || [checkType isEqualToString:@"1"])
return ([fmodel.feedCommentCount integerValue])?259:222;
else
return ([fmodel.feedCommentCount integerValue])?184:142;
}
return 0.0;
}
}
***************************************************************
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier3 = @"loadMore";
static NSString *CellIdentifier = @"TableViewCell";
if (tableView==self.LeftMenuTable)
{
TableViewCell *cell = (TableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:CellIdentifier owner:self options:nil];
cell = [topLevelObjects objectAtIndex:0];
UIView *sepView=[[UIView alloc ]initWithFrame:CGRectMake(0,59, 250, 1)];
[cell.contentView addSubview:sepView];
[sepView setBackgroundColor:[UIColor grayColor]];
}
cell.cellTextLabel.textColor=[UIColor whiteColor];
[cell.cellTextLabel setText:[[leftOptions objectAtIndex:indexPath.row] valueForKey:@"name"]];
[cell.CellImageView setImage:[UIImage imageNamed:[[leftOptions objectAtIndex:indexPath.row] valueForKey:@"image"]]];
cell.selectionStyle=UITableViewCellSelectionStyleNone;
cell.backgroundColor=[UIColor clearColor];
return cell;
}
else
{
NSUInteger row = [indexPath row];
NSInteger countRoe = [allOfficedata count];
if (row == countRoe)
{
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier3];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier3];
}
cell.textLabel.text = @"LoadMore";
return cell;
}else
{
if (indexPath.row == 0)
{
//CellCallOutBox_Onboarding_iPad
//CellCalloutbox_Office_iPad
//CellCalloutbox_Office_iPhone
NSString *nibName;
if ([calloutOffice.is_empty_daily_mission isEqualToString:@"false"]) {
nibName = (isPad)[email protected]"CellCalloutbox_Office_iPad":@"CellCalloutbox_Office_iPhone";
}
else if ([calloutOffice.is_empty_onboarding_mission isEqualToString:@"false"])
{
nibName = (isPad)[email protected]"CellCallOutBox_Onboarding_iPad":@"CellCallOutBox_Onboarding_iPhone";
}
else if ([calloutOffice.is_empty_community_mission isEqualToString:@"false"])
{
nibName = (isPad)[email protected]"CellCallOutBox_Onboarding_iPad":@"CellCallOutBox_Onboarding_iPhone";
}
CellCalloutbox_Office *cellcallout = (CellCalloutbox_Office *)[tableView dequeueReusableCellWithIdentifier:nibName];
if (cellcallout == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:nibName owner:self options:nil];
cellcallout = [nib objectAtIndex:0];
}
cellcallout.aMissionDelegate = self;
[cellcallout.btnVideoOfTheDay addTarget:self action:@selector(videoOfTheDay) forControlEvents:UIControlEventTouchUpInside];
cellcallout.backgroundColor=[UIColor clearColor];
[cellcallout setArraywithCallOut:calloutOffice expanded:isCallOutOfficeExpanded];
[cellcallout.btnBackCallout addTarget:self action:@selector(calloutBack) forControlEvents:UIControlEventTouchUpInside];
[cellcallout.btnDailyMission addTarget:self action:@selector(openCalloutDilyMission) forControlEvents:UIControlEventTouchUpInside];
return cellcallout;
}
Feedmodel *fmodel=[allOfficedata objectAtIndex:indexPath.row];
NSString *checkType = fmodel.achievementType;
if (![checkType isEqualToString:@""] || [checkType isEqualToString:@"0"] || [checkType isEqualToString:@"1"])
{
static NSString *simpleTableIdentifier = @"CellWithImageVideo";
CellWithImageVideo *cell = (CellWithImageVideo *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
NSString *nibNmaeForiPad = (([fmodel.feedCommentCount integerValue])[email protected]"CellWithImage_Comment_iPad":@"Cell_WithImage_MyOffice_iPad");
NSString *nibNmaeForiPhone = (([fmodel.feedCommentCount integerValue])[email protected]"CellWithImagewithComment_iPhone":@"CellWithImageVideo");
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:(isPad)?nibNmaeForiPad:nibNmaeForiPhone owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.backgroundColor=[UIColor clearColor];
cell.contentView.backgroundColor=[UIColor clearColor];
[cell setFeeddata:fmodel indexPath:indexPath];
[cell.hifiveBtn addTarget:self action:@selector(hifiveClickedMyOfiice:) forControlEvents:UIControlEventTouchUpInside];
[cell.playMintBtn addTarget:self action:@selector(getFeedDetails:) forControlEvents:UIControlEventTouchUpInside];
[cell.planToDoBtn addTarget:self action:@selector(planToDoClickedOffice:) forControlEvents:UIControlEventTouchUpInside];
[cell.userImageBtn addTarget:self action:@selector(gotouserProfile:) forControlEvents:UIControlEventTouchUpInside];
[cell.inspireBtn addTarget:self action:@selector(InspireClicked:) forControlEvents:UIControlEventTouchUpInside];
[cell.sendCommentBtn addTarget:self action:@selector(serverCommentPost:) forControlEvents:UIControlEventTouchUpInside];
[cell.btnCompliment addTarget:self action:@selector(getFeedCommentPopup:) forControlEvents:UIControlEventTouchUpInside];
cell.txtFldCommentField.delegate = self;
return cell;
}
else
{
static NSString *simpleTableIdentifier = @"CellWithoutImage";
NSString *nibNmaeForiPad = (([fmodel.feedCommentCount integerValue])[email protected]"Cell_withoutImage_withcomment_iPad":@"Cell_withoutImage_Ipad_Office");
NSString *nibNmaeForiPhone = (([fmodel.feedCommentCount integerValue])[email protected]"CellWithoutImagewithComment_iPhone":@"CellWithoutImage");
CellWithoutImage *cell = (CellWithoutImage *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:(isPad)?nibNmaeForiPad:nibNmaeForiPhone owner:self options:nil];
cell = [nib objectAtIndex:0];
}
[cell setFeeddata:fmodel indexPath:indexPath];
cell.backgroundColor=[UIColor clearColor];
cell.contentView.backgroundColor=[UIColor clearColor];
[cell.hifiveBtn addTarget:self action:@selector(hifiveClickedMyOfiice:) forControlEvents:UIControlEventTouchUpInside];
[cell.planToDoBtn addTarget:self action:@selector(planToDoClickedOffice:) forControlEvents:UIControlEventTouchUpInside];
[cell.userImageBtn addTarget:self action:@selector(gotouserProfile:) forControlEvents:UIControlEventTouchUpInside];
[cell.inspireBtn addTarget:self action:@selector(InspireClicked:) forControlEvents:UIControlEventTouchUpInside];
[cell.btnCompliment addTarget:self action:@selector(getFeedCommentPopup:) forControlEvents:UIControlEventTouchUpInside];
[cell.sendCommentBtn addTarget:self action:@selector(serverCommentPost:) forControlEvents:UIControlEventTouchUpInside];
[cell.btnTextMintTapped addTarget:self action:@selector(getFeedDetails:) forControlEvents:UIControlEventTouchUpInside];
cell.txtFldComment.delegate = self;
return cell;
}
}
}
}
'numberOfRowsInSection'에서 반환 된 값을 확인하십시오. –
돌아 오는 중 return [allOfficedata count] +1; 같은 문제 –
'[allOfficedata count] + 1'의 값이 뭔지 전혀 모르겠다. 어떻게 알 수 있을까? –