开发者

uitableview within the detail side of a splitview

I need to create a tableview within the detail side of a splitview. I have learned how to create a tableview programmatically and have created it in a class called MyTableView. My problem is that the point at which I want to actually create the tableview, I am getting an error. The code from the DetailViewController shown below is being called, but the tableview (called nextView) isn't being populated. Please let me know if you see a silly mistake or can recommend any tutorials that would be helpful.

- (void)setDetailItem:(id)newDetailItem {
    if (detailItem != newDetailItem) {
        [detailItem release];
    detailItem = [newDetailItem retain];
    // Update the view
NSLog(detailItem);
NSString * imageName = [NSString stringWithFormat:@"%@.png",detailItem];
    [self.imageView1 setImage:[UI开发者_JS百科Image imageNamed:imageName]];  
    [self configureView];
}

if (self.popoverController != nil) {
    [self.popoverController dismissPopoverAnimated:YES];
}        
}


- (void)configureView {
NSLog(@"creating tableview");
if(nextView == nil)
    nextView = [[MyTableView alloc] init];  
self.view = nextView;
}

The error reads: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyTableView setFrame:]: unrecognized selector sent to instance 0x4b32e40'

Haven't found an answer for the splitview yet, but two tables within scroll views are working all right. Here's the blog that got me started. http://www.iphonedevsdk.com/forum/iphone-sdk-development/2423-multiple-table-views-single-screen-nothing-showing-up.html


Is the class MyTableView in reality a table view controller. In this case the table view controller has no property frame. You should then to something like

[[MyTableView view] setFrame: newFrame];

And: You should change the name of MyTableView to MyTableViewController.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜