【问题标题】:PopOver and TableviewsPopOver 和 Tableviews
【发布时间】:2011-01-28 16:24:15
【问题描述】:

关于弹出框的快速问题,当我从中选择某些东西时,我似乎没有掌握关闭弹出视图的方法(tableview)

所以我在 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  

}

在标题控制器上,我不知道如何关闭弹出框

【问题讨论】:

    标签: cocoa-touch tableview dismiss popover


    【解决方案1】:

    你可以在 popoverController 上调用dismissPopoverAnimated:。您应该将弹出框的实例保留为实例变量,以便从 UITableViewDelegate 方法中解散。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-27
      • 2019-10-23
      相关资源
      最近更新 更多