ipad popOverController导航怀疑

时间:2012-02-16 11:35:23

标签: iphone

我在按钮点击时显示一个视图控制器作为弹出窗口,它似乎工作正常。但是,选择一个tableview单元格不会导航到下一页。 我的第一个按钮点击代码是

-(IBAction)_clickbtnChapterselection:(id)sender
{
    //build our custom popover view
    BookSelectionview* popoverContent = [[BookSelectionview alloc]
                                         init];

    //resize the popover view shown
    //in the current view to the view's size
    popoverContent.contentSizeForViewInPopover =
    CGSizeMake(500, 600);

    //create a popover controller
    self.popoverController = [[UIPopoverController alloc]
                              initWithContentViewController:popoverContent];

    //present the popover view non-modal with a
    //refrence to the button pressed within the current view
    [self.popoverController presentPopoverFromRect:_btnChapterSelection.frame
                                            inView:self.view
                          permittedArrowDirections:UIPopoverArrowDirectionAny
                                          animated:YES];

    //release the popover content

    [popoverContent release];    
    [self resetReadViewToVerse:1];
}

在BookSelectionview的didselectrowat索引路径clcik

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ChapterSelectionView *detailViewController = [[ChapterSelectionView alloc] initWithNibName:@"ChapterSelectionView" bundle:nil];

    detailViewController.selectedIndex=indexPath.row;
    appDelegate.selectedBookIndex=indexPath.row;
    self.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:detailViewController animated:YES];

    [detailViewController release];

如何让单元格选择导航到Chapterselectionview? 请帮我。 提前谢谢。

1 个答案:

答案 0 :(得分:2)

你的弹出窗口中没有UINavigationController,所以它正常工作。将其更改为支持这样的导航:

//build our custom popover view
BookSelectionview* popoverContent = [[BookSelectionview alloc]
                                         init];    
UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:popoverContent] autorelease];

//resize the popover view shown
//in the current view to the view's size
popoverContent.contentSizeForViewInPopover =
CGSizeMake(500, 600);

//create a popover controller
self.popoverController = [[UIPopoverController alloc]
                              initWithContentViewController:navigationController];