Created
April 2, 2014 20:03
-
-
Save adamgall/9941989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the long text that needs to fit in the label | |
static NSString *longText = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum aliquet ornare quam vitae pulvinar. Vestibulum dapibus posuere facilisis. Maecenas iaculis nibh eu felis accumsan, id blandit metus congue!!!"; | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
if (indexPath.row == 0) { | |
NIAgendaDetailMainCell *cell = [tableView dequeueReusableCellWithIdentifier:@"agendaDetailMainCell" forIndexPath:indexPath]; | |
cell.lblNotes.text = longText; | |
return cell; | |
} else { | |
// generate the other cells | |
} | |
} | |
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
if (indexPath.row == 0) { | |
self.mainCellTemplate.lblNotes.text = longText; | |
CGSize size = [self.mainCellTemplate.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; | |
CGFloat calculatedHeight = size.height; | |
return calculatedHeight; | |
} else { | |
// return the static height of the other cells (44) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment