Reputation: 783
I have created a split view controller i want to reduce the size of the table view but it has built in tableView Controller so is there any way to change the size of the table from code mean i have only 4 rows and it gets all the side in splitViewController i want to reduce the size of tableViewController. In My Root controller it is tableViewController so any way to solve this issue.
I have also attached the image below the image of table in that it has only three records so i want it must show only three line it is showing empty lines also.
Upvotes: 3
Views: 219
Reputation: 4500
You can set the height of each row in this delegate method of UITableView:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
Once you set the height you'll have to reload
your table.
EDIT:
- (void) viewDidLoad
{
[super viewDidLoad];
self.tableView.tableFooterView = [[[UIView alloc] init] autorelease];
}
Upvotes: 1
Reputation: 4279
You can add this code. This will not show extra lines in your UITableView
- (void) addFooter
{
UIView *v = [[UIView alloc] initWithFrame:CGRectZero];
[self.myTableView setTableFooterView:v];
[v release];
}
You can also set height of your row by this
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//Set height according to your condition
if (indexPath.row == 0)
{
}
else
{
}
}
and then you can reload your UITableView
[tableview reloadData];
EDIT: call function addFooter
in - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
and you can add this also
- (float)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
// This will create a "invisible" footer
return 0.01f;
}
Upvotes: 0