How do you change the number of rows and the height of the rows within a table view?
I have four items and I want them to occupy equal portions, but grouped together to take up the entire height of the screen... How is this possible?
How do you change the number of rows and the height of the rows within a table view?
I have four items and I want them to occupy equal portions, but grouped together to take up the entire height of the screen... How is this possible?
To change the height of the rows
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 60;
}
for rows
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
return 4;
}
You should avoid using magic numbers, something like this might be more useful:
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath
{
return self.view.frame.size.height / [yourArray count];
}