Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView numberOfRowsInSection section order problem
    primarykey
    data
    text
    <p>I am having a problem while inserting data in a table view. I have made this little example demonstrating my problem:</p> <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { switch (section) { case 0: NSLog(@"section: %d",section); if([listOfItems count]!=0){ NSLog(@"size: %d",[listOfItems count] / 2); return [listOfItems count] / 2; } else{ sectionCount++; NSLog(@"size: %d", [[listOfComboBoxes objectAtIndex:0] count] - 1); return [[listOfComboBoxes objectAtIndex:0] count] - 1; } break; default: NSLog(@"section: %d",section); NSLog(@"size: %d", [[listOfComboBoxes objectAtIndex:sectionCount++] count] - 1); sectionCount--; return [[listOfComboBoxes objectAtIndex:sectionCount++] count] - 1; break; } } </code></pre> <p>This is what i receive in the log:</p> <pre><code>2011-06-09 11:14:40.753 TemplatesTest[1133:207] section: 3 2011-06-09 11:14:40.754 TemplatesTest[1133:207] size: 2 2011-06-09 11:14:40.754 TemplatesTest[1133:207] section: 0 2011-06-09 11:14:40.755 TemplatesTest[1133:207] size: 6 2011-06-09 11:14:40.755 TemplatesTest[1133:207] section: 1 2011-06-09 11:14:40.756 TemplatesTest[1133:207] size: 11 2011-06-09 11:14:40.756 TemplatesTest[1133:207] section: 2 2011-06-09 11:14:40.757 TemplatesTest[1133:207] size: 20 </code></pre> <p>I am wondering why is it starting with section 3? The correct output should be (if it started with section 0):</p> <pre><code>section: 0 size: 6 section: 1 size: 2 section: 2 size: 11 section: 3 size: 20 </code></pre> <p>Does anyone knows a fix?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload