gpt4 book ai didi

ios - Xamarin 表单,我需要在 IOS 项目中做什么才能让照片显示在 IOS 模拟器中?

转载 作者:行者123 更新时间:2023-11-29 05:46:57 27 4
gpt4 key购买 nike

enter image description here Android 模拟器显示照片,但当我尝试 IOS 模拟器时,照片不显示。照片位于资源中,其属性为嵌入资源。

最佳答案

来自document ,它说:

Prior to iOS 9, images were typically placed in the Resources folder with Build Action: BundleResource. However, this method of working with images in an iOS app has been deprecated by Apple.

我刚刚在iOS上做了一个测试,发现如果你将照片放入资源中,它仍然有效。正确的做法是:

如果您使用.jpg照片,则必须写下全名(我猜您错过了.jpg):

<Image Source="logo.jpg" />

如果您使用 .png 照片,则可以仅使用照片的名称:

<Image Source="logo" />

我不建议您以这种方式添加照片,因为 Apple 已弃用。现在,Apple 建议您将图像添加到 Assets 目录图像集:

转到Assets.xcassets -> 新建新图像集 -> 在那里添加您的照片(1x,2x,3x)。

document中有详细步骤您可以关注。

关于ios - Xamarin 表单,我需要在 IOS 项目中做什么才能让照片显示在 IOS 模拟器中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56049555/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com