views:

1826

answers:

4

Hi,

I am setting the row height of my UITableView using following code

[tableView setRowHeight: 100.00];

I am using the single line as separator in the UITableView.

Eventhough setting the height above, height of row does not get change.

Please help me

+6  A: 

You should implement

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

delegate method. and return 100.0 there.

Morion
Careful. Pratik didn't say he wanted per-row height. heightForRowAtIndexPath can be expensive with a lot of rows.
kevmoo
A: 

I dont think there is such a method in UITableView...

Instead you can use the property rowHeight...
Try, tableView.rowHeight =100;

Dhanesh
Actually it's in UITableViewDelegate.
Epsilon Prime
properties are just easier ways to access Getters/Setters. doing tableView.rowHeight = 100, is exactly the same as [tableView setRowHeight:100].getters/setters are automatically created when u synthesize properties.
Sahil
A: 

The row height is baked into the cells when they are first displayed.

Did you set UITableView#rowHeight before setting the data source?
If not, do so.
If for whatever reason you can't, your other option is to call UITableView#reloadData after setting the row height.

emp
A: 

The better and cleaner solution is to implement the delegate function (Maybe not the best one if your UITableView has many rows ...).

Also, think that UITableVieCell are UIView so you could change their height firstly...

Delegates are very powerful in iPhone dev, here the UITableViewDelage:

http://developer.apple.com/iphone/library/documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html

You can also change the indentForRow, displayCellForRow, heightForRow,edit stuff .....

eBuildy