Reputation: 804
I'm trying to create a UITableview with 2 sections. The first section should contain only one row and the second section should contain 6 rows. How do I define the number of sections? From the storyboard I could define that my table view style is grouped.
Any help will be appreciated.
Many thanks, Marcos
Upvotes: 0
Views: 242
Reputation: 6039
You need to implement the UITableViewDataSource
protocols to populate a table with sections and rows. See the Apple documentation here
Check the solution I submitted for this post; it should point you in the right direction.
Upvotes: 1
Reputation: 226
You supply all of that information at runtime, generally from the view controller. You need to set your view controller as the table view's 'data source', then implement the UITableViewDataSource protocol which is documented here:
The specific method that will determine how many sections are presented is this one:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
Upvotes: 1