【问题标题】:Xamarin Forms / Mobile Blazor Bindings - Images not displaying in iOS app, but fine in Android appXamarin Forms / Mobile Blazor Bindings - 图像未显示在 iOS 应用程序中,但在 Android 应用程序中很好
【发布时间】:2021-11-05 16:39:30
【问题描述】:

问题

我有一个使用 Mobile Blazor 绑定的简单示例应用程序,但在显示简单图像 (.png) 时,Android 和 iOS 版本之间的行为不一致。

安卓应用

示例图片在应用的 Android 版本中按预期显示。

iOS 应用

iOS 版本的应用中不会显示相同的示例图像。

测试图像页面

剃须刀页面仅包含 2 行 HTML(无 C# 代码)。

<h3>Test Image</h3>

<img src="Images/Image.png" style="max-width: 100%;"/>

图像文件 Image.png 位于 Blazor 项目中,在 wwwroot\Images

并将图像文件设置为“始终复制”到输出目录:

任何人都可以就正在发生的事情提供任何建议吗?

非常感谢期待。

【问题讨论】:

  • 你能用这个测试一下吗(/Images/)

标签: android ios xamarin.forms blazor


【解决方案1】:

我曾经在 Xamarin.Forms(但不是 Blazor)中编程,并且在图像名称约定方面遇到了类似的问题。

尝试将图像命名为:image@3x.png,看看是否会显示?

【讨论】:

    【解决方案2】:

    您需要将 images 文件夹放在 iOS 项目的资源文件夹中,这对于保持与 blazor 应用程序中相同的文件夹结构很重要。

    在你应该有的 iOS 项目中,类似这样的东西。

    资源\wwwroot\[yourimagefolder]\[yourimage.png]

    【讨论】:

      猜你喜欢
      • 2019-01-19
      • 1970-01-01
      • 1970-01-01
      • 2018-02-02
      • 1970-01-01
      • 2021-05-09
      • 2021-12-21
      • 2014-07-31
      • 1970-01-01
      相关资源
      最近更新 更多