如何在 React Native 中为 iOS 应用程序使用和显示与 Launch Image 相同的图像?

Posted

技术标签:

【中文标题】如何在 React Native 中为 iOS 应用程序使用和显示与 Launch Image 相同的图像?【英文标题】:How can I use and display the same image shown as Launch Image for an iOS app in React Native? 【发布时间】:2017-07-06 15:34:50 【问题描述】:

我想使用与应用启动时完全相同的图像,在我的第一个场景中显示它并在其上放置一个活动指示器。

我已经看到在./ios/<app name>/Images.xcassets/LaunchImage.launchimage 中有用于启动的所有图像,并且有一个 JSON 文件包含有关使用哪个图像文件的信息,但我怎么知道我的情况(方向、设备) ?

有什么建议吗?非常感谢,我正在使用 React Native。

【问题讨论】:

【参考方案1】:

让图像在 render() 中成为父图像:

render() return ( <Image source=require('./yourImagepath/image.png') style= styles.backgroundImage> <View> .... </View> </Image> ); const styles = StyleSheet.create( backgroundImage: flex: 1, width: '100%', height: '100%', ,

【讨论】:

这不是我需要的,伙计:D 我的应用程序已经准备好了,我已经从头开始创建了整个应用程序。我唯一无法做到的是获取要显示的正确图像,与 Launch Image 相同。

以上是关于如何在 React Native 中为 iOS 应用程序使用和显示与 Launch Image 相同的图像?的主要内容,如果未能解决你的问题,请参考以下文章