Not able to access array with ids in another view controller in iphone
these is some code from my project..
for (index=0; index<[feed count]; index++) {
//NSLog(@"........%@",[feed objectAtIndex:2]);
NSString* forName=[feed objectAtIndex:index];
NSString *nameString = [forName valueForKey:@"name"];
NSLog(@"--------%@",nameString);
[nameArray addObject:nameString];
NSString *idString = [forName valueForKey:@"id"];
NSLog(@"--------%@",idString);
[idArray addObject:idString];
}
MyFriends *detailViewController = [[MyFriends alloc] initWithNibName:@"MyFriends" bundle:nil];
// ...
// Pass the selected object to the new view controller.
detailViewController.fbNames=nameArr开发者_JAVA百科ay;
detailViewController.fbIds=idArray;
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
My problem is in another controller when I am accessing array with names which is fbNames
in another class it is showing me proper names,But when I am accessing fbIds
which is the array with Ids ...they are showing me null..
how to correct this?
here...in this class ...fbNames are working fbIds are not..
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [fbNames count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
cell.textLabel.text=[fbNames objectAtIndex:indexPath.row];
NSLog(@"%@",cell.textLabel.text);
return cell;
}
NSString* forName=[feed objectAtIndex:index];
NSString *nameString = [forName valueForKey:@"name"];
I don't think NSString
has valueForKey:
精彩评论