xcode 模态演示样式“在当前上下文中”和“在全屏上”之间有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40160985/
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-09-15 09:28:48  来源:igfitidea点击:

What is the difference between the modal presentation style "over current context" and "over fullscreen"?

iosxcode

提问by user2636197

I wonder what the difference between current context and over fullscreen is?

我想知道当前上下文和全屏显示之间的区别是什么?

When I switch between them I don't see any changes in my app. All the animations look the same etc.

当我在它们之间切换时,我的应用程序中没有看到任何变化。所有的动画看起来都一样等等。

采纳答案by Rashwan L

fullScreen:
The presented view covers the screen (fullscreen).

fullScreen:
呈现的视图覆盖屏幕(fullscreen)

currentContext:
The UIModalPresentationCurrentContextstyle covers a specific view controller in your interface. When using the contextual style, you designate which view controller you want to cover by setting its definesPresentationContext property to true.

currentContext:
UIModalPresentationCurrentContext风格涵盖了你的界面特定视图控制器。使用上下文样式时,您可以通过将其definePresentationContext 属性设置为 来指定要覆盖的视图控制器true

When presenting a view controller using the UIModalPresentationFullScreen style, UIKit normally removes the views of the underlying view controller after the transition animations finish. You can prevent the removal of those views by specifying the UIModalPresentationOverCurrentContext style instead. You might use that style when the presented view controller has transparent areas that let underlying content show through.

当使用 UIModalPresentationFullScreen 样式呈现视图控制器时,UIKit 通常会在过渡动画完成后移除底层视图控制器的视图。您可以通过指定 UIModalPresentationOverCurrentContext 样式来防止删除这些视图。当呈现的视图控制器具有让底层内容显示出来的透明区域时,您可以使用该样式。

Read more about presenting viewControllers here.

在此处阅读有关呈现 viewController 的更多信息。

回答by Yuchen Zhong

There aren't any visual differences if you are presenting a view controller from a view controller that is already in full screen mode. However, if the presenting view controller isn't in full screen mode, the current contextwill make a different. For example:

如果您从已经处于全屏模式的视图控制器中呈现视图控制器,则没有任何视觉差异。但是,如果呈现视图控制器未处于全屏模式,则当前上下文会有所不同。例如:

  • Left: before present, the current view controller is not in full screen mode
  • Middle: presenting a new view controller with full screen
  • Right: presenting a new view controller with current context
  • 左:出现之前,当前视图控制器未处于全屏模式
  • 中:呈现一个新的全屏视图控制器
  • 右:呈现一个具有当前上下文的新视图控制器

A full list of comparison of different presentation mode available here on Github.

Github上可用的不同演示模式的完整比较列表。