Programming/iOS - ObjC
UITableView - Cell 높이 설정
Tez.Park
2010. 11. 26. 10:25
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 높이;
}
<응용>
// 행높이
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == timeLineCount-1) {
return 40;
} else {
UIFont *font = [UIFont systemFontOfSize:13];
CGSize withinSize = CGSizeMake(300, 80);
CGSize size = [[lastestTweets objectAtIndex:indexPath.row] sizeWithFont:font constrainedToSize:withinSize lineBreakMode:UILineBreakModeWordWrap];
UIFont *font2 = [UIFont systemFontOfSize:11];
CGSize withinSize2 = CGSizeMake(300, 80);
CGSize size2 = [[userAccountName objectAtIndex:indexPath.row] sizeWithFont:font2 constrainedToSize:withinSize2 lineBreakMode:UILineBreakModeWordWrap];
return (size.height+ size2.height)*2;
}
}
반응형