"OC 中 present 出的页面不是全屏内容:在 OC 中,可以通过设置 UIViewController 的 modalPresentationStyle 属性来控制 present 出的页面是否全屏显示。默认情况下,present 出的页面是全屏显示的,但可以通过修改 modalPresentationStyle 属性来改变这一行为。\n\n以下是几种常见的 modalPresentationStyle 属性值:\n\n1. UIModalPresentationFullScreen:这是默认值,表示 present 出的页面全屏显示,覆盖整个屏幕。\n\n2. UIModalPresentationPageSheet:表示 present 出的页面以页单显示,非全屏显示。在 iPad 上,页面将在屏幕中间显示,并且周围会有一部分透明背景。在 iPhone 上,该值与 UIModalPresentationFullScreen 相同。\n\n3. UIModalPresentationFormSheet:表示 present 出的页面以表单单显示,非全屏显示。在 iPad 上,页面将在屏幕中间显示,并且周围会有一部分透明背景。在 iPhone 上,该值与 UIModalPresentationFullScreen 相同。\n\n4. UIModalPresentationCustom:表示自定义的 present 样式,可以通过自定义转场动画来实现非全屏显示。\n\n可以使用以下代码来设置 modalPresentationStyle 属性:\n\n\nUIViewController *viewController = [[UIViewController alloc] init];\nviewController.modalPresentationStyle = UIModalPresentationPageSheet; // 设置为非全屏显示\n[self presentViewController:viewController animated:YES completion:nil];\n\n\n通过设置不同的 modalPresentationStyle 属性值,可以实现不同的页面展示效果。\n

OC 中 present 页面非全屏显示:设置 modalPresentationStyle 属性

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

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