Section in the section - UITableView -

I only have a question regarding tableView.

I know that 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:

  • Section in section (and, if possible, another section) - - And then adjust the lines there?

And that I would return to

 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
+6
source share
1 answer

You will need to make your own implementation in cellForRowAtIndexPath, where you will return a string that really consists of several rows and possibly a title label. Or maybe it’s better to make each line a β€œtitle line” and check cellForRowAtIndexPath whether you are in the title line or a regular line; something like that:

 if (indexPath.row == 0) { // return header row } else { // return normal row } 

and, of course, in numberOfRowsInSection you will need to return the normal number of rows + 1 for sections with a header.

+9
source

Source: https://habr.com/ru/post/890064/


All Articles