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 开发者_如何学Pythonvalue.
- (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!
From your code it looks like you are never creating an instance of the your detail controller.
精彩评论