테이블 셀의 높이가 각각 다른 테이블을 만드는중 문제가 생겼다.
테이블 셀의 뷰를 놓고 그 위에 텍스트 박스를 놓았는데 텍스트 내용의 길이에 따라서 높낮이를 조절해야 한다.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([indexPath row] == 0) {
return 100;
}
return 80;
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellId = @"cellId ";
CellId *cell = (CellId *)[tableView
dequeueReusableCellWithIdentifier: cellId];
if (cell == nil)
{
cell = [[[NSBundle mainBundle] loadNibNamed:@"CellId"
owner:self options:nil] lastObject];
}
if ([indexPath row] == 0) {
//CGRect rect = cell.view.bounds; 이걸로는 안되더라..
//cell.view.bounds = CGRectMake(rect.origin.x,rect.origin.y, 768, 100); //.size = CGSizeMake(768, 100);
CGRect rect = cell.view.frame;
cell.view.frame = CGRectMake(rect.origin.x,rect.origin.y, 768, 100);
}
return cell;
}
'프로그램 경험 > iOS' 카테고리의 다른 글
[iPhone] expected specifier-qualifier-list before 'virtual' (0) | 2010.11.19 |
---|---|
[iPhone] TableView의 전체 셀 접근하기 & 선택표시 사라지기 (0) | 2010.11.05 |
[iPhone] UIImageView에 테두리 넣기 (0) | 2010.10.06 |
[iPhone] 그룹 설정된 테이블뷰 바탕색상 변경하기 (0) | 2010.10.06 |
[iPhone] 클래스명으로 객체 생성하기 (0) | 2010.10.06 |