簡體   English   中英

在表格視圖單元格上顯示彈出框

[英]popover display on tableview cell

我在我的應用程序中使用TableView時,當我單擊一個表格單元格時我想要一個彈出視圖,表格Cell中的所有內容都應該顯示在彈出視圖中,所以請建議我怎么做?

我下面有一些示例代碼不起作用..所以建議使用代碼,我希望單元格中的所有內容都顯示在彈出視圖中。

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

{

UIView *aView = [[UIView alloc] init];

UIPopoverController *popoverController = [[UIPopoverController alloc] 
                                          initWithContentViewController:aView];
popoverController.popoverContentSize = CGSizeMake(320, 416);
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[popoverController presentPopoverFromRect:cell.bounds inView:cell.contentView 
                 permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

}

用這個

[popoverController presentPopoverFromRect:[cell frame] inView:cell.contentView 
                 permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

然后檢查。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM