简体   繁体   English

故事板:如何弹出不全屏

[英]Storyboard: How to popover not full screen

Need a popover when pressed brightness button. 按下亮度按钮时需要弹出窗口。 Popover need to be NOT FULL-SIZED. Popover需要不是全尺寸的。 I tried several setting but it always present as full-sized screen. 我尝试了几个设置,但它始终显示为全尺寸屏幕。 What do you think I need to keep it 280x150px? 您认为我需要保持280x150px?

在此输入图像描述

在此输入图像描述

在此输入图像描述

在此输入图像描述

It sounds like this may be an issue with default iOS popover behavior. 听起来这可能是默认iOS popover行为的问题。 Popovers are only used for iPad / Regular Width size classes by default, and are full screen modals on iPhone / Conpact Width size classes. 弹窗尺寸默认仅用于iPad / Regular Width尺寸类,并且是iPhone / Conpact Width尺寸类的全屏模式。

This WWDC session covers that default behavior, and how to override it to have a popover presentation style on iPhone: 此WWDC会话涵盖了该默认行为,以及如何覆盖它以在iPhone上具有弹出式呈现样式:

https://developer.apple.com/videos/play/wwdc2014/214/ . https://developer.apple.com/videos/play/wwdc2014/214/ (Skip to around 36:15) (跳到36:15左右)

我在故事板中看到你把它当作brigthness处理,你可能在准备中写下它的亮度

  1. Create childViewController with UIView inside its view with proper constraint and UI element in it that u want to display as popUp. 在其视图中创建带有UIView的childViewController,其中包含适当的约束和UI元素,您希望将其显示为popUp。

  2. Set background color of childViewController to default color. 将childViewController的背景颜色设置为默认颜色。

  3. Add segue from view (eg button , on click of which you have to show childViewController as popup) to childViewController with type Present Modally with presentation "Over current context" and transition type as "Cross Dissolve". 从视图中添加segue(例如,按钮,在点击时必须将childViewController显示为popup)到childViewController,其类型为Present Modally,带有演示文稿“Over current context”,转换类型为“Cross Dissolve”。

  4. Make sure you have added constraint to view inside childViewController view properly so it will display at correct position as popUp. 确保添加了约束以正确查看childViewController视图内部,以便它以popUp的形式显示在正确的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM