Populating an array into a TableView - Thanks in advance.

Posted by tssav on Stack Overflow See other posts from Stack Overflow or by tssav
Published on 2011-01-02T13:31:05Z Indexed on 2011/01/03 7:53 UTC
Read the original article Hit count: 256

Hello Developers,

View not being populated with the array. I would really appreciate if I could get some help.

Thanks!!

In a tableView I have the following:

NSDictionary *cat = [category objectAtIndex:indexPath.row];  
cell.textLabel.text = [cat valueForKey:@"reference"];

This populates the tableView with the content of the array from an XML file. There is another array “data” that prints out the content to the debug console and I want to populate another view with this content. But I am having lot of trouble populating the next view with the data array.

NSLog(@"cellForRowAtIndexPath-- Reference:%@: Verse:%@", [cat valueForKey:@"reference"], [cat valueForKey:@"data"]);

The didSelectRowAtIndexPath method looks like this:

Verse *vvc = [[Verse alloc] initWithNibName:@"VerseView" bundle:nil];  vvc.verses = [[category objectAtIndex:indexPath.row] valueForKey:@"verse"];  
[self.navigationController pushViewController:vvc animated:YES];  
        [vvc release];  
    [tableView deselectRowAtIndexPath:indexPath animated:YES];   

In the cellForRowAtIndexPath of the next view I have the following:

NSDictionary *cat = [verses objectAtIndex:indexPath.row];  
cell.textLabel.text = [cat valueForKey:@"data"];

What I would like is to have the “data” in a textView.

I don’t know what’s wrong. Any help would be appreciated!

© Stack Overflow or respective owner

Related posts about arrays

Related posts about uitableview