ios单应用模式

Apple launched the much-awaited iOS 13 updates globally on September 19 across all iPhones launched within the past 4 years (back to the iPhone 6s).

苹果于9月19日在全球发布了期待已久的iOS 13更新,该更新适用于过去4年内发布的所有iPhone(返回iPhone 6s)。

One of the biggest features of this update was the system-wide iOS 13 dark mode. It's expected to help with eye-strain caused by white light emitted by smartphone displays.

此更新的最大功能之一是系统范围的iOS 13暗模式。 它有望帮助缓解由智能手机显示屏发出的白光引起的眼睛疲劳。

While this feature is a joy to end-consumers using Apple devices, it's a task for iOS developers to prepare an app ready for iOS 13 dark mode.

虽然此功能对于使用Apple设备的最终用户而言是一种乐趣,但iOS开发人员的任务是准备可用于iOS 13暗模式的应用程序。

如何为iOS 13黑暗模式设置您的应用程序? (How to Set up your App for iOS 13 Dark Mode?)

To help developers with this issue, here is useful info and steps showing how they can prep up an existing iOS app for iOS 13 dark mode.

为帮助开发人员解决此问题,此处提供了有用的信息和步骤,显示了他们如何为iOS 13暗模式准备现有的iOS应用。

  • It’s not too hard to implement iOS 13 dark mode despite its system-wide scale.尽管它具有系统范围的规模,但实现iOS 13黑暗模式并不难。
  • Enabling iOS 13 dark mode on your existing app is also simple mostly thanks to the latest iOS 13 SDK. 由于最新的iOS 13 SDK,在现有应用程序上启用iOS 13暗模式也很简单。

When using the latest version to build apps for iOS 13 dark mode, the OS will automatically update switches, buttons, and table views among other system controls. Though do note that images and text colors won’t adjust for dark mode automatically.

使用最新版本为iOS 13暗模式构建应用程序时,操作系统将自动更新其他系统控件中的开关,按钮和表格视图。 不过请注意,图片和文字颜色不会自动调整为暗模式。

However, it’s still amazing to see that a system-wide change such as dark mode is so easy to implement. There are smaller code changes and more work that you'll be able to get done with the iOS 13 dark mode in that saved time.

但是,令人惊奇的是,系统范围的更改(如暗模式)如此容易实现。 在节省的时间内,使用iOS 13暗模式可以进行更小的代码更改和更多的工作。

如何为iOS 13深色模式调整颜色 (How to Adapt Colors For iOS 13 Dark Mode)

First, let’s start with changing system colors iOS 13 dark mode:

首先,让我们从更改系统颜色iOS 13暗模式开始:

Now there are new system colors added in UIColor, one of which is a label color. Using these new colors helps support dark mode and other high contrast modes in iOS 13.

现在,UIColor中添加了新的系统颜色,其中一种是标签颜色。 使用这些新颜色有助于在iOS 13中支持暗模式和其他高对比度模式。

label.color = UIColor.secondaryLabel

Generally, you should use system colors for iOS 13 dark mode, which automatically adapts to changes in the interface for maintaining consistency across apps. However, developers can also choose to implement dark mode with custom colors.

通常,您应该为iOS 13深色模式使用系统颜色,该颜色会自动适应界面更改,以保持应用程序之间的一致性。 但是,开发人员还可以选择使用自定义颜色实现暗模式。

The asset catalog colors introduced with iOS 11 make it much easier to support dark mode by adding dark versions of a custom set of colors.

通过添加自定义颜色组的深色版本,iOS 11引入的资产目录颜色使支持深色模式更加容易。

You only have to select a preferred color from the catalog, then change Appearances to Any, Dark from the Attributes Inspector.

您只需从目录中选择一种首选颜色,然后从“属性”检查器中将“外观”更改为“任意,深色”。

That's it! Now you have a custom iOS 13 dark mode ready for your mobile app.

而已! 现在,您已经为移动应用程序准备了自定义iOS 13暗模式。

对iOS 13暗模式进行故障排除 (Troubleshooting iOS 13 Dark Mode )

Let's say your app is not following iOS 13 dark mode. What will you do? Here are some easy steps to solve this issue.

假设您的应用未遵循iOS 13暗模式。 你会怎么做? 以下是解决此问题的一些简单步骤。

第1步 (Step 1)

You will need to know if the app is updated or not.

您将需要知道该应用程序是否已更新。

If the app is not working with iOS 13 Dark Mode or does not support it, simply update the app via Apple Store.

如果该应用程序无法在iOS 13暗模式下使用或不支持它,只需通过Apple Store更新该应用程序。

第2步 (Step 2 )

Check whether the Dark Mode of your iOS app has been enabled or not.

检查您的iOS应用的黑暗模式是否已启用。

If not, go to Settings - Display & Brightness - check whether "Dark" is enabled or not.

如果不是,请转到设置-显示和亮度-检查是否启用了“暗”。

第三步 (Step 3  )

If your app is fully updated, but isn't working with iOS 13 Dark Mode, then check the in-app settings. See the image:

如果您的应用程序已完全更新,但不能在iOS 13暗模式下使用,请检查应用程序内设置。 见图片:

If you want more help on setting up your iOS 13 Dark Mode, get it from the dedicated development teams. And, that is how I'm going to help you.

如果您需要更多有关设置iOS 13暗模式的帮助,请从专门的开发团队获得 。 而且,这就是我将如何帮助您。

Also read tips for mobile app development on iOS. Hope all this information will be helpful for you.

另请阅读有关在iOS上进行移动应用开发的提示。 希望所有这些信息对您有所帮助。

Let's see what you have to do next.

让我们看看您接下来要做什么。

为iOS 13暗模式调整图像 (Adapt Images For iOS 13 Dark Mode)

Most images look great in iOS 13 dark mode, and at times they pop out in a way that really highlights details. However, you may still end up finding some images which look a bit off or unsuitable for dark mode.

大多数图像在iOS 13暗模式下看起来很棒,有时会以突出显示细节的方式弹出。 但是,您仍然可能最终会发现一些看起来有些偏离或不适合黑暗模式的图像。

The good news is that you can adjust images for dark mode in the same way text is adjusted.

好消息是,您可以以调整文本的相同方式将图像调整为暗模式。

All you need to do is select the image in the catalog and as done previously, and change attributes to Any, Dark in the Attributes Inspector. Now add the dark appearance of the image and we’re done.

您需要做的就是选择目录中的图像,并像以前一样进行操作,然后在“属性”检查器中将属性更改为“任意,黑暗”。 现在添加图像的深色外观,我们完成了。

以编程方式在iOS 13暗模式下检测更改 (Programmatically Detecting Changes in iOS 13 Dark Mode)

Developers could face situations where they need to implement appearance changes in iOS 13 dark mode programmatically. This is how it's done:

开发人员可能会遇到需要以编程方式在iOS 13暗模式下实现外观更改的情况。 这是这样做的:

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?)
{super.traitCollectionDidChange(previousTraitCollection)let userInterfaceStyle = traitCollection.userInterfaceStyle // Either .unspecified, .light, or .dark// Update your user interface based on the appearance
}

Overriding traitCollectionDidChange helps in detecting appearance changes.

覆盖traitCollectionDidChange有助于检测外观变化。

Then we only have to open traitCollection.userInterfaceStyle.

然后,我们只需要打开traitCollection.userInterfaceStyle。

You can also verify if the existing appearance is using a new method you just implemented:

您还可以验证现有外观是否正在使用刚实现的新方法:

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {super.traitCollectionDidChange(previousTraitCollection)let hasUserInterfaceStyleChanged = previousTraitCollection.hasDifferentColorAppearance(comparedTo: traitCollection) // Bool// Update your user interface based on the appearance
}

覆盖用户界面样式 (Overriding the User Interface Style)

完整的应用程序 (Complete App)

The system automatically opts-in any app linked against the iOS 13.0 or later SDK to both light and dark appearances.

系统会自动选择将与iOS 13.0或更高版本的SDK链接的任何应用程序显示为浅色和深色。

If you need extra time to work on your app’s Dark Mode support or want to keep your app in a single style, you can opt-out by including the UIUserInterfaceStyle key (with a value of Light or Dark) in your app’s Info.plist file.

如果您需要更多时间来处理应用程序的“暗模式”支持,或者希望使应用保持单一样式,则可以通过在应用的Info.plist文件中包含UIUserInterfaceStyle键(值为Light或Dark)来选择退出。

Setting this key causes the system to ignore the user’s preference and always apply the specific appearance to your app.

设置此键会导致系统忽略用户的偏好,并始终将特定外观应用于您的应用。

Note: Supporting iOS 13 Dark Mode is strongly encouraged. Use the UI UserInterfaceStyle key to opt-out only temporarily while you work on improvements to your app’s Dark Mode support.

注意:强烈建议支持iOS 13黑暗模式。 在改进应用程序的暗模式支持时,请使用UI UserInterfaceStyle键仅暂时退出。

特定画面 (Specific Screens)

In iOS 13, you can now override the user interface style on specific views or view controllers. For example, you may want only a certain view controller to be in iOS 13 dark mode, while the rest of your app is in light mode.

在iOS 13中,您现在可以在特定视图或视图控制器上覆盖用户界面样式。 例如,您可能只希望某个视图控制器处于iOS 13暗模式,而其他应用程序处于亮模式。

To override the user interface style, just override this variable in the top view or view controller and it will propagate down to sub-views:

要覆盖用户界面样式,只需在顶视图或视图控制器中覆盖此变量,它将向下传播到子视图:

// Inside a UIViewController
override func viewDidLoad()
{super.viewDidLoad()// Always adopt a dark interface style.    overrideUserInterfaceStyle = .dark
}

结束语 (Closing Notes)

Thanks for reading the article! Here we've explored how to set up an app for iOS 13 dark mode.

感谢您阅读本文! 在这里,我们探讨了如何为iOS 13暗模式设置应用。

iOS 13 dark mode brings with it a unique stress-free way to use a smartphone. Perhaps we’ll see a future where dark mode replaces the default mode with the whiter backgrounds.

iOS 13黑暗模式带来了独特的无压力使用智能手机的方式。 也许我们会看到黑暗模式将默认模式替换为白色背景的未来。

By following these coding guidelines and tips you can easily set up your app for dark mode on iOS 13.

通过遵循这些编码准则和提示,您可以轻松地在iOS 13上将应用设置为暗模式。

If you need some expert help, feel free to get in touch with iOS developers for iOS 13 dark mode related queries.  

如果您需要一些专家帮助,请随时与iOS开发人员 联系以进行有关iOS 13暗模式的查询。

Follow on Twitter for more updates: https://twitter.com/ValueCoders

在Twitter上关注以获取更多更新: https //twitter.com/ValueCoders

翻译自: https://www.freecodecamp.org/news/how-to-setup-an-app-for-dark-mode-on-ios-13-untitled/

ios单应用模式

ios单应用模式_如何为iOS 13暗模式设置应用相关推荐

  1. ios 高德获取定位_更新日志-iOS 定位SDK | 高德地图API

    高德地图iOS 定位 SDK V2.6.7            2020-08-28 1.适配iOS14定位权限:新增"模糊定位"权限下的兼容策略: 2.修复bug,提升性能和稳 ...

  2. ios 访问网络共享_如何从iOS设备无线访问网络共享

    ios 访问网络共享 Syncing files between your computer and your iOS device via iTunes can be tedious and req ...

  3. 工厂模式 构建者模式_实践中的构建者模式

    工厂模式 构建者模式 我将不深入讨论该模式,因为已经有大量的文章和书籍对此进行了详细的解释. 相反,我将告诉您为什么以及何时应该考虑使用它. 但是,值得一提的是,这种模式与< 四人帮>一书 ...

  4. 从java多态到策略模式_设计模式中的多态——策略模式详解

    2. 策略模式详解 2.1 策略模式定义 策略模式定义了一系列算法,并将每一个算法封装起来,而且使它们还可以相互替换.策略模式让算法独立于使用它的客户端而独立的变化. 可以使用多态进行类比来理解策略模 ...

  5. emacs 编辑模式_作家的5种Emacs模式

    emacs 编辑模式 并非所有作家都在文字处理器的范围内工作. 我们中有很多人在不起眼的(有时不是那么不起眼的 )文本编辑器中敲出单词. 当您找到一个适合您的文本编辑器并按照您想要的方式工作时,您倾向 ...

  6. 使用商业模式的九大模块去分析京东的商业模式_【荐读】商业模式新生代

    ⊙投稿信箱:624380939@qq.com(欢迎您原创投稿) 作者:亚历山大·奥斯特瓦德.伊夫·皮尼厄 人生的长度是有限的,我们只能努力拓展人生的厚度和广度.感受经典的启迪与激励,做好我们的企业,思 ...

  7. java bridge 模式_学习:java设计模式—Bridge模式

    一.引子 下面是吕振宇大牛的一个例子,个人觉得挺好的,有助于理解Bridge模式的设计目的: 设想要绘制一幅图画,蓝天.白云.绿树.小鸟,如果画面尺寸很大,那么用蜡笔绘制就会遇到点麻烦.毕竟细细的蜡笔 ...

  8. 如何为YouTube启用暗模式

    YouTube's dark mode provides an easier-on-the-eyes viewing experience. It's particularly nice when w ...

  9. 华为matepad切换电脑模式_华为MatePad Pro关于PC模式常用操作指南

    华为MatePad Pro关于PC模式常用操作指南移动办公时代,随时都有公务需要处理,平板虽然便捷,但是用于办公确不太方便,窗口应用切来切去,每次找文件,点了一层有一层,想要达到笔记本的办公效率,他必 ...

最新文章

  1. 8天学通MongoDB——第七天 运维技术
  2. echarts中graphic_使用Pyecharts进行奥运会可视化分析!
  3. 大班运用计算机教学案例,幼儿园大班体验课程教学案例
  4. Revit二次开发--Hello World
  5. HashSet 与TreeSet和LinkedHashSet的区别
  6. 音频特效:Flanger 和 Chorus
  7. Python_微信开发
  8. LeetCode1139. 最大的以 1 为边界的正方形 (二维滑动窗口待优化)
  9. 返回数组指针或引用。
  10. 【新书推荐】【2019.01】离散数学及其应用(第五版)
  11. IDEA下载主题、修改主题、删除主题
  12. dosbox详细安装级及使用
  13. java后台提示信息弹出框
  14. vCenter6.5+虚拟ISCSi
  15. LTP(Linux Test Project)使用指南
  16. python图例重复显示_python matplotlib图例重复
  17. 辅材先生之打开传统向互联网+辅材这把锁
  18. 嵌入式linux之yocto(三)qemu
  19. OS20190301
  20. proxmox ve 7.2 AMD显卡直通 网卡驱动 调度器

热门文章

  1. prometheus--初见
  2. 【Elastic Stack(一)】Elastic Stack简介
  3. 微信小程序插件功能页开发详细流程
  4. 正则匹配出字符串中两串固定字符区间的所有字符
  5. layoutSubviews 调用情况
  6. Linux环境搭建 | 手把手教你安装Linux虚拟机
  7. React文档 state and lifecycle
  8. php7+的php-fpm参数配置,注意事项
  9. RPC-原理及RPC实例分析
  10. springbatch apache-activemq 整合(往mq中put数据,从mq中take数据)