Note that there are some explanatory texts on larger screens.

plurals
  1. POcellForRowAtIndexPath getting the right data under each section
    primarykey
    data
    text
    <p>I'm stuck with a problem populating an <code>UITableView</code>. I have got an <code>NSMutableArray</code> with <code>customers</code>. It looks like this:</p> <pre><code>customer first letter="A" customer name="Adwars Inc." customer first letter="A" customer name="Amman Co." customer first letter="B" customer name="Building Inc." customer first letter="C" customer name="Computer Co." </code></pre> <p>So I've got an object customer, which separates me each customer. And i've got some keys for each object. In my second NSArray i've got all my first letters, which appear in my customer data. It look like this:</p> <pre><code>A B C D G J M S Z </code></pre> <p>I was able to get my right section count and rows in section, but when i try to populate my table view it always look like this:</p> <p><a href="http://files.beger.org/iOS%20Simulator%20Bildschirmfoto%2029.04.2012%2014.44.16.png" rel="nofollow">SCREENSHOT</a></p> <p>HERE IS MY CODE</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"CustomerCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease]; } for(int i = 0; i &lt; [firstletters count]; i++) { if (indexPath.section == i) { for(int count = 0 ;count &lt; [customers count]; count++) { NSString *firstletter; NSString *key; key = [firstletters objectAtIndex:indexPath.section]; firstletter = [[customers objectAtIndex:count] objectForKey: @"FirstLetter"]; if ([key isEqualToString:firstletter]) { cell.textLabel.text = [[customers objectAtIndex:count] objectForKey: @"S_NAME1"]; cell.detailTextLabel.text = [[customers objectAtIndex:count] objectForKey: @"s_town"]; } } } } return cell; } </code></pre> <p>What do i have to do to make it work?</p>
    singulars
    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.
    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