I have a scroll view, and inside the scroll view I programmatically add tables with same name (the tables count not always the same number) and I add them in the scroll using a loop.
My issue: my app makes the first table, puts data in it, then builds the second one and puts data, but when it puts data in the second one, the data in the first one changes because they have the same name.
How can i fix this issue?
for ( int i=0; i<[P1Rows count]; i++) {
[self AddPricesTable:i];
}
- (void)AddPricesTable:(int)GroupNum{
self.TableView = [[[UITableView alloc] initWithFrame:CGRectMake(ScrollView.frame.size.width * GroupNum, 0,
ScrollView.frame.size.width, ScrollView.frame.size.height) style:UITableViewStylePlain] autorelease];
self.TableView.backgroundColor = [UIColor blackColor];
self.TableView.dataSource = self;
self.TableView.delegate = self;
P1Dict = [P1Rows objectAtIndex: GroupNum];
NSLog(@"%@", [P1Dict objectForKey:@"Group"]);
P2URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://xxx.co/SFP/?Q=P2&V=%@",
[[P1Dict objectForKey:@"Group"] stringByReplacingOccurrencesOfString:@" " withString:@"%20"]]];
NSLog(@"%@", P2URL);
P2JsonString = [[NSString alloc] initWithContentsOfURL:P2URL usedEncoding:Encoding error:&Error];
P2JsonData = [P2JsonString dataUsingEncoding:NSUTF32BigEndianStringEncoding];
P2Dict = [[[CJSONDeserializer deserializer] deserializeAsDictionary:P2JsonData error:&Error] retain];
[self CheckConnect];
P2Rows = [P2Dict objectForKey:@"SFP"];
[self.TableView reloadData];
[ScrollView addSubview:self.TableView];
}