2011-11-23 78 views
0

我有一个表格视图,每个部分有4个部分和1个行。是否有办法让第一部分的行比其他行更大?表视图部分高度

回答

0

是的,这是可能的。您可以在返回之前更改单元格的框架

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 

因此它更大。只需添加类似

UITableViewCell * cell = ... 
// ... 
if(indexPath.section == 0 && indexPath.row == 0){ 
    // change the frame of the cell 
} 
// ... 
return cell; 
+0

我使用awakeformnib,在那里我设置高度如何获得该方法中的部分?谢谢 – Alfonso

+0

我用这个方法heightForRowAtIndexPath感谢您的帮助 – Alfonso

+0

我很高兴我可以帮助:) – Warkst

0

实现以下方法(从UITableViewDelegate实施)

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 
{ 
    if (section == 0) 
    { 
     return 100; // the desired height 
    } 
    else 
    { 
     return 44; // or whatever your default cell height is 
    } 
} 

编辑:误解你的问题。按照沃克斯特的建议。