tags:

views:

60

answers:

2

how to make the first three row height should be 60 and remaining row height should be 25 in UITableView.

How can i do this?

Thanks.

A: 

Use this example and adjust the condition from "selected row" to "row number".

tob
how to find the row number?if i use NSLog(@"Row=%d",indexPath.row);It displays 0,0,1,0 in console.
vinay
That's exactly how to do it. The reason why you see the same number several times is because your table view has asked the delegate for it several times. This is dependent on display.
tob
So what should i do?should i call any delegate?
vinay
No, just ask the `indexPath` for its `row` and return a cell height `CGFloat` depending on the row number.
tob
Thanks tob. But i am getting the indexPath.row values as 0,0,1,0.How can i make it 0,1,2,3
vinay
See comment 2. You don't have to do anything special. Just implement as suggested in comment 4.
tob
+2  A: 

Check out this link you can get the idea how we have to do it

different-height-for-alternative-cell-in-uitableview

or you can use the below delegate function

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
     if (indexPath.row < 3)
     {
        return 60;
     }
     else
     {
        return 25;
     }
}

HAppy Coding...

Suriya