我在主菜单中有一个按钮。按钮会显示一个popoveontroller ,,,名为bookselectionview ,,,它由tableview组成,当我点击它时,它导航到popover内的另一个视图控制器, 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控制器中我把这个ode放在我的tableview中选择了metho
- (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.