自定义 splitView 不调用 setDetailItem

发布于 2024-11-09 11:51:49 字数 1895 浏览 0 评论 0原文

我的自定义拆分视图中的表控制器出现问题。我有一个 TableViewController 作为我的弹出窗口。我在选择表中的项目时遇到问题。

我遇到的问题是 setDetailItem 方法没有被调用。在我的 TableViewController 中,在 didSelectRow 方法中,我将 viewController 的 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 viewController'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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

懷念過去 2024-11-16 11:51:49

从您的代码来看,您似乎从未创建详细控制器的实例。

From your code it looks like you are never creating an instance of the your detail controller.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文