【发布时间】:2011-05-26 16:39:27
【问题描述】:
现在我有一张表格,上面列出了许多 PDF。用户可以从表格中选择一个 PDF,它将显示在视图中。现在,当我从表中选择和项目时,它应该将 detailView 的 detailItem 更改为我选择的行中的项目,此外将变量 i 更改为选定的行号。
这是我的DidSelectRowAtIndexPath 方法的样子:
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
affirmaPDFViewController.detailItem = [NSString stringWithFormat:@"%@", [listOfPDF objectAtIndex:indexPath.row]];
affirmaPDFViewController.i = indexPath.row;
NSLog(@"%d", indexPath.row); //returns the proper value
NSLog(@"%@", [listOfPDF objectAtIndex:indexPath.row]); //returns the proper value
//NSLog(@"%d", affirmaPDFViewController.i); //DOES NOT return the proper value
//NSLog(@"%@", affirmaPDFViewController.detailItem); //DOES NOT return the proper value
}
对于前两个 NSLog,它们显示正确的信息,但是当我检查最后两个时,它们会显示 affirmaPDFViewController.i = 0 和 affirmaPDFViewController.detailItem = null。当我需要affirmaPDFViewController.i= indexPath.row 和affirmaPDFViewController.detailItem = 我选择的行中的项目时。
有人知道为什么他们没有给出正确的值吗?
提前致谢!
【问题讨论】:
标签: xcode ios ipad uitableview uipopovercontroller