-3

I am developing a drilldown tableview,

I created the two tables, and I am able to display and pass data using json; my first tableview has play objects but when i click an object item (say play 1), i want to display characters,
a play has a atitle, genre and date

In mysql database; I have several different plays and each of them have several characters each. Everything else is working, except this;

for (int i=0; i<4; i++)
{
    play.ids = [[json objectAtIndex:i] objectForKey:@"id"];
    play.title= [[json objectAtIndex:i] objectForKey:@"title"];
    play.genre=[[json objectAtIndex:i] objectForKey:@"genre"];
    play.date= [[json objectAtIndex:i] objectForKey:@"date"];
    NSString *characters=[[json objectAtIndex:i] objectForKey:@"character"];
    sCharacters2= [[NSMutableArray alloc] initWithObjects:characters, nil];

    play.characters=sCharacters2;        

   [playList addObject:play];  
}

This only prints the last play,

but I want it to print all the plays anything I am doing wrong?

Got it, Got, for those who may encounter such a problem, you need to create a new object, so in this case, I should have created a new play object after for statement

user1430825
  • 121
  • 2
  • 10

1 Answers1

-1

For the showing data on tableview you can use simple method of tableview

and for data passing between view controllers you can check this

Community
  • 1
  • 1
Hemant Singh Rathore
  • 2,153
  • 1
  • 24
  • 38