ios iPad 中 UIModalPresentationFormSheet 的确切大小是多少

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6490947/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 20:31:52  来源:igfitidea点击:

What is the exact size of UIModalPresentationFormSheet in iPad

iosxcodeipadinterface-buildersize

提问by Sagar R. Kothari

I am using following code for displaying a Screen/View Controller.

我正在使用以下代码来显示屏幕/视图控制器。

SearchParams *nxt=[[SearchParams alloc] initWithNibName:@"SearchParams" bundle:nil];

UINavigationController *nvc=[[UINavigationController alloc] initWithRootViewController:nxt];

nvc.modalPresentationStyle=UIModalPresentationFormSheet;

[self.preLCtr.preCinescape_iPadViewController presentModalViewController:nvc animated:YES];

I am not sure about the size of PesentationSheet. I tried to take screenshots & take dimentions/size. But its not the exact solution.

我不确定 PesentationSheet 的大小。我试图截取屏幕截图并获取尺寸/大小。但它不是确切的解决方案。

Question : What is the exact size of Present-Modal-Sheet in iPad ?

问题:iPad 中 Present-Modal-Sheet 的确切大小是多少?

回答by mkral

This is what I found for the current (iPad 3) iO6 dimensions:

这是我发现的当前(iPad 3)iO6 尺寸:

BOUNDS: 540.000000, 620.000000- Portrait-no-keyboard.

BOUNDS: 540.000000, 620.000000- 纵向无键盘。

But you shouldn't use this for any code. Follow the correct answer.

但是您不应该将它用于任何代码。遵循正确答案。

回答by ugiflezet

According to Apple's documentationthe size could change depending on the available screen size:

根据 Apple 的文档,尺寸可能会根据可用的屏幕尺寸而变化:

The width and height of the presented view are smaller than those of the screen and the view is centered on the screen. If the device is in a landscape orientation and the keyboard is visible, the position of the view is adjusted upward so that the view remains visible. All uncovered areas are dimmed to prevent the user from interacting with them.

呈现的视图的宽度和高度小于屏幕的宽度和高度,并且视图在屏幕上居中。如果设备处于横向并且键盘可见,则向上调整视图的位置,以便视图保持可见。所有未覆盖的区域都变暗以防止用户与它们交互。

Maybe in the viewcontroller that is loaded to the FormSheet you can determine the view size at runtime by using: self.view.bounds;

也许在加载到 FormSheet 的视图控制器中,您可以使用以下方法确定运行时的视图大小: self.view.bounds;

If you need to resize the FormSheet i saw some answers on stackoverflow

如果您需要调整 FormSheet 的大小,我在stackoverflow上看到了一些答案

回答by Kyle Clegg

If you're adjusting a freeform view controller so that you can get the aspect right for a modal transition with form sheet presentation style, note that there is a Form Sheetoption under the Size dropdown in the Size Inspector. I didn't notice this at first.

如果您正在调整自由形式的视图控制器,以便您可以为具有表单演示样式的模态转换获得正确的方面,请注意Form Sheet在尺寸检查器的尺寸下拉菜单下有一个选项。我一开始没有注意到这一点。

enter image description here

在此处输入图片说明

回答by Phillip

I checked different orientation and also in multi window mode, the default size is

我检查了不同的方向,也在多窗口模式下,默认大小是

width: 540, height: 620.

width: 540, height: 620.

And below is the screenshot from Reveal.

下面是来自 Reveal 的截图。

enter image description here

在此处输入图片说明