1

我在主菜单中有一个 barbutton ..点击该按钮将显示一个 popoveontroller,,,称为 bookselectionview,,,它由 tableview 组成,当我点击 cel 它导航到弹出框内的另一个视图控制器,,seondview 包括按钮,当我点击任何按钮时,它导航到弹出控制器内的第三个视图控制器......一切正常......但我的问题是,当我点击第三视图中的任何按钮时,我想关闭这个 popoverontroller......并且必须导航到主视图..现在它显示了popoverontrollerr中的主视图..我尝试了很多东西,但没有任何帮助......我的代码是......

在主视图的栏按钮中,我输入了这段代码

  BookSelectionview* popoverContent = [[BookSelectionview alloc]
                                         init];    
    UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:popoverContent] autorelease];

    popoverContent.contentSizeForViewInPopover =
    CGSizeMake(500, 800);

    self.popup = [[UIPopoverController alloc]
                              initWithContentViewController:navigationController];

    [self.popup presentPopoverFromRect:CGRectMake(348, 0, 0, 0)
                                            inView:self.view
                          permittedArrowDirections:UIPopoverArrowDirectionAny
                                          animated:YES];

然后在我的bookselectionview控制器中,我把这个颂歌放在我的tableview中确实选择了方法

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {


 ChapterSelectionView *detailViewController = [[ChapterSelectionView alloc] initWithNibName:@"ChapterSelectionView" bundle:nil];
    detailViewController.contentSizeForViewInPopover =
    CGSizeMake(500, 600);

    //detailViewController.firstString = firstString;
    // ...
    // Pass the selected object to the new view controller.
    detailViewController.selectedIndex=indexPath.row;
    appDelegate.selectedBookIndex=indexPath.row;
    self.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:detailViewController animated:YES];

    [detailViewController release];

}

在我的seconview(chapterselectionview)中,我将此codee放在按钮cilk中

-(void)ButtonClicked:(UIButton *)sender{
    [NSThread detachNewThreadSelector: @selector(spinBeginchapterselection) toTarget:self withObject:nil];

        VersusSelectionView *detailViewController = [[VersusSelectionView alloc] initWithNibName:@"VersusSelectionView" bundle:nil];
    detailViewController.contentSizeForViewInPopover =
    CGSizeMake(500,600);

    detailViewController.selectedChapter=[sender.titleLabel.text intValue];
    appDelegate.selectedChapterIndex=[sender.titleLabel.text intValue];
    self.hidesBottomBarWhenPushed=YES;
    [self.navigationController pushViewController:detailViewController animated:YES];

    [detailViweController relese];

然后在我的第三个视图中,即 verseviewcontroller 我把这段代码导航到主视图(parallelReaviewcontroller)这里我需要关闭弹出窗口......

-(void)ButtonClicked:(UIButton *)sender{
    [self dismissModalViewControllerAnimated:YES];
    [NSThread detachNewThreadSelector: @selector(spinBeginverseselection) toTarget:self withObject:nil];



    appDelegate.selectedBook = [appDelegate.books objectAtIndex:appDelegate.selectedBookIndex];
    appDelegate.selectedChapter = [NSString stringWithFormat:@"%d",appDelegate.selectedChapterIndex];
    appDelegate.selectedVerse = [NSString stringWithFormat:@"%d",[sender.titleLabel.text intValue]];
    [appDelegate reloadVerses];

        ParallelReadViewController *detailViewController = [[ParallelReadViewController alloc] initWithNibName:@"ParallelReadViewController" bundle:nil];

    [self.navigationController pushViewController:detailViewController animated:YES];

    [detailViewController release];
 please help me to solve this problem,,,thanks in advance.
4

0 回答 0