Cocoa touch PopOver和桌面视图

Cocoa touch PopOver和桌面视图,cocoa-touch,tableview,dismiss,popover,Cocoa Touch,Tableview,Dismiss,Popover,关于弹出窗口的快速问题,当我从弹出窗口中选择某个内容(tableview)时,我似乎没有掌握关闭它的方法 因此,我有一个列表项目在一个表视图中,它使用UIPopoverController弹出,所以当我选择一个项目时,我希望popove淡出 主视图控制器 - (IBAction)popoverFontName:(id)sender CGRect popoverRect = [self.view convertRect:[popoverFontName frame]

关于弹出窗口的快速问题,当我从弹出窗口中选择某个内容(tableview)时,我似乎没有掌握关闭它的方法

因此,我有一个列表项目在一个表视图中,它使用UIPopoverController弹出,所以当我选择一个项目时,我希望popove淡出

主视图控制器

  - (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];

}
- (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  

}
标题控制器

  - (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];

}
- (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

您可以在PopoOver控制器上调用dismissPopoOveranimated:。为了从UITableViewDelegate方法中退出,您应该将popover的实例保留为实例变量