PopOver和Tableviews

时间:2011-01-28 16:24:15

标签: cocoa-touch tableview dismiss popover

关于弹出窗口的快速提问,当我从中选择一些东西时,我似乎没有抓住关闭popview的方法(tableview)

所以我在tableview上有一个列表项,弹出使用UIPopoverController,所以当我选择一个项目时,我想让popove消失。

MainViewController

  - (IBAction)popoverFontName:(id)sender 
    CGRect popoverRect = [self.view convertRect:[popoverFontName frame] 
                                       fromView:[popoverFontName superview]];
    TitleController *titleC=[[TitleController alloc]init];
    popup =[[UIPopoverController alloc]initWithContentViewController:titleC];

    [popup presentPopoverFromRect:popoverRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    [popup setPopoverContentSize:CGSizeMake(50.0, 300.0)];

    [titleC release];

}

TitleController

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

    NSString *selectedLang = [titleList objectAtIndex:indexPath.row];  

    //Initialize the detail view controller and display it.  
    MyDetViewCont *myDetViewCont = [[MyDetViewCont alloc] initWithNibName:@"myDetViewCont" bundle:[NSBundle mainBundle]]; // view controller instance  

}

在标题控制器上,我不知道如何解雇popover

1 个答案:

答案 0 :(得分:0)

您可以在popoverController上调用dismissPopoverAnimated :.您应该将popover的实例保留为实例变量,以便从UITableViewDelegate方法中解除。

相关问题