面对这样的问题,当我单击表格视图单元格上的项目以将项目数据传递到详细视图控制器页面时,它会显示另一个索引项目详细信息。无法传递准确的数据。 :(是否有人可以帮助我。
这是我在didselectrowAtIndexpath方法中做的示例代码
NSString *name = featured.name;
DetailViewController *detail = [[DetailViewController alloc]initWithNibName:@"DetailViewController"
bundle:[NSBundle mainBundle]];
detail.dname = name;
[self.navigationController pushViewController:detail animated:YES];
[detail release];
detail = nil;
答案 0 :(得分:1)
您必须在didselectrowAtIndexpath中编写此代码,如
NSString *name = [Myarray objectAtIndex:indexPath.row];
detail.dname = name;
DetailViewController *detail = [[DetailViewController alloc]initWithNibName:@"DetailViewController"
bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:detail animated:YES];
[detail release];
detail = nil;
修改强>
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if([elementName isEqualToString:@"Record"]){
//
[passDics setObject:[forgot_pass stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] forKey:@"Forgot_Message"];
[myarray addObject:passDics
}
}