问题描述
|
我有一个“ 0”,它由一个弹出框表示,通过选择工具栏上的一个栏按钮项可以显示该弹出框。我遇到了一个问题,但是当我从弹出窗口的表格中选择一个项目时,它不会更新视图(
affirmaPDFViewController
)
这是我的PDFTableController
(弹出框)的DidSelectRowAtIndex
方法:
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
affirmaPDFViewController.detailItem = [Nsstring stringWithFormat:@\"%@\",[listofPDF objectAtIndex:indexPath.row]];
affirmaPDFViewController.i = indexPath.row;
NSLog(@\"%d\",indexPath.row);
NSLog(@\"%@\",[listofPDF objectAtIndex:indexPath.row]);
NSLog(@\"%d\",affirmaPDFViewController.i);
NSLog(@\"%@\",affirmaPDFViewController.detailItem);
}
在这里,indexPath.row和objectAtIndex:indexPath.row都返回正确的值。但是,当我将变量“ 1”分配给这些值时,它们仅返回0和null。
有人告诉我这是因为我还没有创建affirmaPDFViewController
的实例。但是,我不确定如何创建这样的实例。我将在此方法中放入什么代码才能使其正常工作?
提前致谢!
解决方法
-(void)viewDidLoad
{
[super viewDidLoad];
affirmaPDFViewController = [[[NameOfClassGoesHere alloc] initWithNibName:@ \“ NibNameGoesHere \” bundle:nil];
}