안녕하세요 저는 기본 셀 높이 44.0로가 UITable 전망을 가지고 지금 우리는 같은 셀 내용에 따라이 증가 할 이미지로 내가 이것을 사용하고 있지만이 작동하지 않습니다 UITable보기 셀 높이를 늘리는 방법 적합한 셀 내용에 따라 런타임?
.....
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
int rowHeight =0.0f;
// NSString *stringToSize = [shared.combine_address objectAtIndex:indexPath.row];
CGSize size = [ [shared.combine_address objectAtIndex:indexPath.row] sizeWithFont:[UIFont systemFontOfSize:13.0f] constrainedToSize:CGSizeMake(743, 44) lineBreakMode:NSLineBreakByWordWrapping];
rowHeight = self.table.rowHeight+size.height;
return rowHeight;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
// UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
SWTableViewCell *cell2 = (SWTableViewCell *)[tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if(tableView==table)
{
//static NSString *cellIdentifier = @"Cell";
if (cell2 == nil) {
cell2 = [[SWTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:MyIdentifier
containingTableView:table // Used for row height and selection
leftUtilityButtons:nil
rightUtilityButtons:[self rightButtons]];
cell2.delegate = self;
cell2.selectionStyle=UITableViewCellSelectionStyleNone;
}
NSLog(@"CELL 1 %@",cell2.textLabel.text);
cell2.textLabel.lineBreakMode=NSLineBreakByWordWrapping;
cell2.textLabel.numberOfLines=0;
cell2.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:15.0f];
cell2.detailTextLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell2.detailTextLabel.numberOfLines = 0;
[cell2.textLabel sizeToFit];
}
return cell2;
}
일회 검사 CGSizeMake (743, 44) 가치 라벨 폭은 귀하의 경우 743이어야합니다. – Balu
이 답변을 업데이트했습니다. 다른 방법을 시도해보십시오. – Selvin
cellforrowindexpath 코드를 추가 하시겠습니까? – NANNAV