自定义 splitView 不调用 setDetailItem
我的自定义拆分视图中的表控制器出现问题。我有一个 TableViewController
作为我的弹出窗口。我在选择表中的项目时遇到问题。
我遇到的问题是 setDetailItem
方法没有被调用。在我的 TableViewController
中,在 didSelectRow
方法中,我将 viewControlle
r 的 detailItem
设置为所选内容,但是它没有注册,而是 detailItem
显示为 null。
这是我的 TableViewController 中的内容,这是用于在表中选择对象的句柄。
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
/*
When a row is selected, set the detail view controller's detail item to the item associated with the selected row.
*/
affirmaPDFViewController.detailItem = [NSString stringWithFormat:@"%@", [listOfPDF objectAtIndex:indexPath.row]];
affirmaPDFViewController.i = indexPath.row;
}
这是我的 detailViewController
中的内容,当为DetailItem 分配新值时应该调用该内容。
- (void)setDetailItem:(id)newDetailItem {
NSInteger start = 0;
if (detailItem != newDetailItem) {
[detailItem release];
detailItem = [newDetailItem retain];
// Update the view.
[self configureView];
start = ((i) * 768);
scrollView.contentOffset = CGPointMake(webView1.frame.origin.x + start, webView1.frame.origin.y);
counter = start / 768;
}
if (popoverController != nil) {
[popoverController dismissPopoverAnimated:YES];
}
}
在我的 TableViewController.h
文件中,我有:
#import <UIKit/UIKit.h>
@class AffirmaPDFViewController;
@interface PDFTableController : UITableViewController {
AffirmaPDFViewController *affirmaPDFViewController;
NSMutableArray *listOfPDF;
}
@property (nonatomic, retain) IBOutlet AffirmaPDFViewController *affirmaPDFViewController;
@property (nonatomic, retain) NSMutableArray *listOfPDF;
@end
在实现文件中,我综合了affirmaPDFViewController。
关于为什么 setDetailItem 没有被调用的任何想法?
提前致谢!
I'm having a problem with a table controller in my custom split view. I have a TableViewController
which stands as my popover. I'm having a problem when selecting an item in the table.
The issue I'm having is that the setDetailItem
method isn't being called. In my TableViewController
, in the didSelectRow
method I'm setting my viewControlle
r's detailItem
to the thing selected, however it isn't registering and instead detailItem
comes out as null.
Here is what is in my TableViewController, this is the handle for selecting an object in the table.
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
/*
When a row is selected, set the detail view controller's detail item to the item associated with the selected row.
*/
affirmaPDFViewController.detailItem = [NSString stringWithFormat:@"%@", [listOfPDF objectAtIndex:indexPath.row]];
affirmaPDFViewController.i = indexPath.row;
}
Here is what is in my detailViewController
this what is supposed to be called when detailItem is assigned to a new value.
- (void)setDetailItem:(id)newDetailItem {
NSInteger start = 0;
if (detailItem != newDetailItem) {
[detailItem release];
detailItem = [newDetailItem retain];
// Update the view.
[self configureView];
start = ((i) * 768);
scrollView.contentOffset = CGPointMake(webView1.frame.origin.x + start, webView1.frame.origin.y);
counter = start / 768;
}
if (popoverController != nil) {
[popoverController dismissPopoverAnimated:YES];
}
}
In my TableViewController.h
file I have:
#import <UIKit/UIKit.h>
@class AffirmaPDFViewController;
@interface PDFTableController : UITableViewController {
AffirmaPDFViewController *affirmaPDFViewController;
NSMutableArray *listOfPDF;
}
@property (nonatomic, retain) IBOutlet AffirmaPDFViewController *affirmaPDFViewController;
@property (nonatomic, retain) NSMutableArray *listOfPDF;
@end
and in the implementation file I'm synthesizing the affirmaPDFViewController.
Any ideas as to why setDetailItem isn't being called?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从您的代码来看,您似乎从未创建详细控制器的实例。
From your code it looks like you are never creating an instance of the your detail controller.