在OC中,可以通过设置UIViewController的modalPresentationStyle属性来控制present出的页面是否全屏显示。默认情况下,present出的页面是全屏显示的,但可以通过修改modalPresentationStyle属性来改变这一行为。

以下是几种常见的modalPresentationStyle属性值:

  1. UIModalPresentationFullScreen:这是默认值,表示present出的页面全屏显示,覆盖整个屏幕。

  2. UIModalPresentationPageSheet:表示present出的页面以页单显示,非全屏显示。在iPad上,页面将在屏幕中间显示,并且周围会有一部分透明背景。在iPhone上,该值与UIModalPresentationFullScreen相同。

  3. UIModalPresentationFormSheet:表示present出的页面以表单单显示,非全屏显示。在iPad上,页面将在屏幕中间显示,并且周围会有一部分透明背景。在iPhone上,该值与UIModalPresentationFullScreen相同。

  4. UIModalPresentationCustom:表示自定义的present样式,可以通过自定义转场动画来实现非全屏显示。

可以使用以下代码来设置modalPresentationStyle属性:

UIViewController *viewController = [[UIViewController alloc] init];
viewController.modalPresentationStyle = UIModalPresentationPageSheet; // 设置为非全屏显示
[self presentViewController:viewController animated:YES completion:nil];

通过设置不同的modalPresentationStyle属性值,可以实现不同的页面展示效果

oc中present出的页面不是全屏

原文地址: http://www.cveoy.top/t/topic/hLkK 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录