I have couple of problems with my UITableView
.
When I add a UITableview
on my page, by default it brings up some fixed number of rows,
[self.SomeTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
Use this to get rid of the lines if the UITableView
is empty.
A bit hidden in Bourne's answer; if you want to hide to bottom empty rows in a plain tableview with multiple sections, use this answer:
https://stackoverflow.com/a/5658100/580173
You sure you are using UITableViewStyleGrouped
style?
Because by default it is set to UITableViewStylePlain
which shows empty cells too after displaying filled cells.
in the method that returns the number of rows, specify the count
yourself dynamically. For example if you are going to populate the table with say a NSArray
named arrayForRows:
return [arrayForRows count]; // inside the method which returns the number of rows.
The above is a simple example populating a table with an array as a datasource. There are no empty rows. Only that many rows show up in the table according to the count
of items in the array populating the table.
I think you mean height of the row in the table. You can play around with the height of the rows by using the method:
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
read http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITableViewDelegate/tableView:heightForRowAtIndexPath:
EDIT: ah now I get what you are trying to achieve. You are trying to avoid showing the empty rows separated with those separator lines right? See this post:
how to display a table with zero rows in UITableView
This can also be done through Interface Builder. Simply add a 1 pixel tall UIView as a footer to the UITableView. It's essentially the same as most of the answers here, but it keeps some UI specifics in the view instead of in the view controller.