Hi there,
I'm currently building an iPhone app that will display data from an NSMutableArray called "stories". The array structure looks like so (via NSLog):
2009-07-20 12:38:30.541 testapp[4797:20b] (
{
link = "http://www.testing.com";
message = "testing";
username = "test";
},
{
link = "http://www.testing2.com";
message = "testing2";
username = "test2";
} )
My cellForRowAtIndexPath looks like this currently:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
for (NSDictionary *story in stories) {
[cell setTextColor:[UIColor whiteColor]];
[cell setFont: [UIFont systemFontOfSize:11]];
cell.text = [NSString stringWithFormat:[story objectForKey:@"message"]];
}
return cell;
}
Currently my UITableView displays multiple entries of the SAME item (which happens to be the final set in the array). How can I get it to successfully loop through the array and display the next item's message in the cells one after the other.
Thanks in advance :)
Benji