Pat*_*bee 5 xamarin.ios uipopovercontroller ios
我正在显示来自自定义 UITableViewCell 的 UIPopoverPresentationController。当用户点击单元格时,我们会显示一个弹出窗口,其中包含一个带有一些可编辑字段的 UIScrollView。
sourceView设置为父Controller的View,SourceRect设置为TableCell
popoverPresentationController.SourceView = presentingViewController.View;
popoverPresentationController.PermittedArrowDirections = UIPopoverArrowDirection.Any;
var rectInTableView = containingTableView.RectForRowAtIndexPath(path);
var rectInSuperView = containingTableView.ConvertRectToView(rectInTableView, containingTableView.Superview);
// The "/2" on the Height of the SourceRect was so the PopOver appear half way into the cell rather than at it's bottom edge
popoverPresentationController.SourceRect = new CGRect(rectInSuperView.X, rectInSuperView.Y, rectInSuperView.Width, rectInSuperView.Height / 2);
Run Code Online (Sandbox Code Playgroud)
这工作正常,直到键盘出现。如果我不听 WillReposition 委托,则弹出窗口将动画移到视图的左上角
如果我尝试将弹出动画重新定位到只有 10 个左右的像素高
我看过键盘显示时uipopover 隐藏,并且在键盘消失后 UIPopoverController 的视图控制器会调整大小