gpt4 book ai didi

ios - PopOverController 出现在所选单元格旁边

转载 作者:行者123 更新时间:2023-11-29 01:20:30 24 4
gpt4 key购买 nike

我正在 Xamarin.iOS 平台上开发一个 tableviewcontroller。

当用户点击表格 View 第一部分的第二行时,以下代码起作用。

当用户点击时,会出现弹出 View 。但是,弹出窗口的位置不会出现在所选单元格的旁边。我该如何处理呢?

public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
if (indexPath.Row == 1 && indexPath.Section == 0) {
var vc = new IViewController (this,ivc.iInfo);
var nc = new NavigationController (vc);
nc.PreferredContentSize = new System.Drawing.SizeF (200, 300);
UIPopoverController popupoverController = new UIPopoverController (nc);
popupoverController.PresentFromRect (tableView.Bounds, tableView, UIPopoverArrowDirection.Any, true);
}

最佳答案

而不是使用 tableView,您应该使用选定的单元格,如下所示。

UITableViewCell cell = tableView.CellAt(indexPath);
popupoverController.PresentFromRect (cell.Bounds, cell, UIPopoverArrowDirection.Any, true);

关于ios - PopOverController 出现在所选单元格旁边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34660956/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com