Ios iPad模态视图';在主窗口中选择s rect
我在UISplitViewController的顶部显示一个模态视图(带有UIModalPresentationFormSheet)。我想得到模态视图相对于UISplitViewController(基本上是整个窗口)将采用的确切rect。i、 e.模态视图位于x、y坐标和尺寸。 我怎么找到这个?我查看了UIView的“convertRect:fromView:”方法,但无法确定哪种组合会起作用Ios iPad模态视图';在主窗口中选择s rect,ios,objective-c,uikit,Ios,Objective C,Uikit,我在UISplitViewController的顶部显示一个模态视图(带有UIModalPresentationFormSheet)。我想得到模态视图相对于UISplitViewController(基本上是整个窗口)将采用的确切rect。i、 e.模态视图位于x、y坐标和尺寸。 我怎么找到这个?我查看了UIView的“convertRect:fromView:”方法,但无法确定哪种组合会起作用 谢谢。[splitView convertRect:modallyPresentedVC.view.
谢谢。
[splitView convertRect:modallyPresentedVC.view.bounds fromView:modallyPresentedVC.view]
应该可以做到这一点。确保在演示文稿的完成块中调用它(在所有动画完成之后)。谢谢,但它似乎会给出一些奇怪的结果。我尝试了以下操作:[self-presentViewController:navController动画:是的完成:^{CGRect clippedRect=[split.view convertRect:childController.view.bounds toView:childController.view];}];但是它给出了一些奇怪的坐标:{-242,-128},{540,576}}为了让它正常工作,你需要这样呈现:[split presentViewController:navController animated:YES completion:…]
。否则,没有superview链,您将得到错误的结果。你仍然可以计算它,但它会更复杂。