简体   繁体   English

根据应用方案更改启动屏幕的 storyboard 背景颜色

[英]Change storyboard background color of the Launch Screen based on app scheme

I use a view for my splashscreen in React native app on iOS and now we have two schemes and we want to change this view color.我在 iOS 上的 React 本机应用程序中为我的闪屏使用了一个视图,现在我们有两个方案,我们想要更改这个视图颜色。

if scheme === App scheme A? "green": "purple" if scheme === App scheme A? "green": "purple" is there a way to make this multiple values like bundle id and product name if scheme === App scheme A? "green": "purple"有没有办法让这个多个值像捆绑 ID 和产品名称

It is certainly possible to have different splash screens, resources etc. per app version, and there is a number of ways to achieve that.每个应用程序版本当然可以有不同的启动屏幕、资源等,并且有很多方法可以实现这一点。 One that I would recommend looking into is using different build configurations.我建议研究的一个是使用不同的构建配置。 A working example:一个工作示例:

使用不同方案构建应用程序时显示不同启动画面的 gif

Steps:脚步:

  1. In Project->Info->Configurations, duplicate existing configurations and give them meaningful names (eg. matching your custom scheme):在 Project->Info->Configurations 中,复制现有配置并给它们起有意义的名称(例如,匹配您的自定义方案): 第一步,显示构建配置设置

  2. Edit your custom scheme to use the new build configuration (in the 'Run' tab, select the debug version, in the 'Archive' tab, select the release version):编辑您的自定义方案以使用新的构建配置(在“运行”选项卡中,select 是调试版本,在“存档”选项卡中,select 是发布版本): 第二步,显示方案编辑选项

  3. Create a new storyboard for your launch screen为您的启动屏幕创建一个新的 storyboard

  4. In your Target Build Settings, add a new User Defined setting, name it sth like 'LAUNCH_SCREEN_NAME' and set value according to build configuration:在您的目标构建设置中,添加一个新的用户定义设置,将其命名为“LAUNCH_SCREEN_NAME”并根据构建配置设置值: 第四步,显示用户定义的构建设置

  5. Finally in your Info.plist, edit or add a 'Launch screen interface file base name' key and set value to the custom build setting from point 4 ( $(LAUNCH_SCREEN_NAME) )最后在您的 Info.plist 中,编辑或添加“启动屏幕界面文件基本名称”键并将值设置为第 4 点的自定义构建设置( $(LAUNCH_SCREEN_NAME) 第五步,在 info plist 中显示启动屏幕键

  6. For React Native, you will also need to add and configure react-native-schemes-manager - I'm assuming you might have already done this since you are using schemes.对于 React Native,您还需要添加和配置react-native-schemes-manager - 我假设您可能已经这样做了,因为您正在使用方案。

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

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