hello I have UITable view there by default cell height 44.0 and now we want to increase this according to cell content like as image
I am using this but this is not working .....
- (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;
}