2012-04-16 145 views
0

我有一个应用程序分为四个视图,当我点击一个视图时,该应用程序显示一个弹出窗口,并且该弹出窗口有一个导航控制器。我可以在视图之间导航,并且数据显示正确。但是,当我在最后一个视图中,并点击一行时,弹出窗口不会消除(我想在didSelectRowAtIndexPath中)。如何使用导航控制器关闭弹出窗口?

怎么办?

我试过这种方式,我创建了一个方法,关闭弹出窗口,我调用这个方法en didSelectRowAtIndexPath,但没有奏效。

这是

-(IBAction)mostrarTabla:(id)sender 
{ 
    // Popover that shows the table 
    UIPopoverController *popover; 

    // RootViewController is the first view 

    RootViewController *rootViewController = [[RootViewController alloc] init]; 
    // With a nav bar 
    UINavigationController *navBar = [[UINavigationController alloc] initWithRootViewController:rootViewController]; 
    [rootViewController release]; 

    // Popover customitation 
    navBar.contentSizeForViewInPopover = CGSizeMake(20.0f, 20.0f); 
    popover = [[UIPopoverController alloc] initWithContentViewController:navBar]; 
    [navBar release]; 
    popover.delegate = self; 
    popover.popoverContentSize = CGSizeMake(320.0f, 832.0f); 

    // PopOver is shows in the view 1 
    [popover presentPopoverFromRect:CGRectMake(100.0f, 10.0f, 20.0f, 20.0f) inView:_view1 permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 
} 

我在此创建视图控制器

-(void)hidePopover 
{ 
    [self.popOver dismissPopoverAnimated:YES]; 
} 

而且在我使用的方法的最后一个视图的方法在主视图控制器的方法,但没有工作

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    ViewController *grafica = [[ViewController alloc] init]; 

    self.indicadorId = [[self.arrayId objectAtIndex:indexPath.row] integerValue]; 

    DataIndicador *datos =[[DataIndicador alloc] init]; 

    datos.idIndicador = self.indicadorId; 

    [datos release]; 


    [grafica hidePopover]; 
} 

在上一个视图中,我希望弹出窗口返回到其视图并显示数据(图表)

感谢

回答

0

的视图控制器的画报即时是不一样的VieController的任何瞬间最初提出的酥料饼。