Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add one array into 2 sections UITableView
    primarykey
    data
    text
    <p>Here is my code:</p> <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSInteger numberOfRowsPerSection = 0; if (section == 0) { for (int i = 0; i &lt; [[[BNRItemStore sharedStore] allItems] count]; i ++) { BNRItem *item = [[[BNRItemStore sharedStore] allItems] objectAtIndex:i]; if ([item valueInDollars] &gt; 50) { numberOfRowsPerSection ++; } } }else{ for (int i = 0; i &lt; [[[BNRItemStore sharedStore] allItems] count]; i ++) { BNRItem *item = [[[BNRItemStore sharedStore] allItems] objectAtIndex:i]; if ([item valueInDollars] == 73) { numberOfRowsPerSection ++; } } } return numberOfRowsPerSection; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell"]; if (!cell) { cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"UITableViewCell"]; } BNRItem *p = [[[BNRItemStore sharedStore] allItems] objectAtIndex:[indexPath row]]; if ([p valueInDollars] &gt; 50 &amp;&amp; indexPath.section == 0) { [[cell textLabel] setText:[p description]]; }else if(indexPath.section == 1){ [[cell textLabel] setText:[p description]]; } return cell; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 2; } </code></pre> <p>I want to display in one section results > 50 and the other section the rest of the result but I don't know how to do it. I am getting duplicate results in each section.</p> <p>Thanks</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