I just have a question with regards to the tableView.
I know we can return the number of sections and rows with.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
Could you tell me how I can have something like :
- A section within a section (and another section, if possible) - - And then configure the rows there ?
And what would I return in
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
Implementation of adding a table view inside the cell of UItableview aka, Nested Table View. Used the Power of Autosizing table view and delegate to achieve the expansion and collapse of the cell height.
UITableView with sections allows us to separate the list into different categories, so the list looks more organized and readable. We can customize sections as per our need, but in this tutorial, we are covering the basic UITableview with sections. Here's is the video if you prefer video over text. Let Create An App.
Index paths describe an item's position inside a table view or collection view, storing both its section and its position inside that section. For example, the first row in a table would have section 0, row 0, whereas the eighth row in the fourth section would have section 3, row 7.
IndexPath contains information about which row in which section the function is asking about. Base on this numbers you are configuring the cell to display the data for given row.
You will have to make your own implementation in cellForRowAtIndexPath where you return a row that is really made up of multiple rows and maybe a header label. Or maybe better is to make every other row a "header row" and check in cellForRowAtIndexPath whether you are on a "header row" or normal row; something like this:
if (indexPath.row == 0) {
// return header row
} else {
// return normal row
}
and of course in numberOfRowsInSection you will have to return the normal amount of rows + 1 for sections with a header.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With