【问题标题】:UIImageView not showing images on XamarinUIImageView 未在 Xamarin 上显示图像
【发布时间】:2018-08-17 13:03:04
【问题描述】:

我正在开发 Xamarin Forms 应用程序并且必须更改 LaunchScreen.storyboard 文件。 我添加了一个 ImageViewer 并选择了一个图像,但它没有加载到情节提要中。

图像属性下拉列表保持为空。

有人遇到过这样的问题吗?

【问题讨论】:

  • 图片在哪里?
  • 你可以把buggystoryboard的代码贴在这里供其他人查看
  • 图片位于资源文件夹@Jason。
  • 没有代码,我只在可视模式下编辑情节提要@NickKovalsky
  • LaunchScreen.storyboard 可以看成代码粘贴在这里

标签: c# xamarin xamarin.forms xamarin.ios uiimageview


【解决方案1】:

我有同样的问题,因为我将 VS 更新到最新版本 (15.8.1) 它在资源文件夹中创建图像。我现在的解决方法是设置整个图像,然后关闭编辑器并手动将 image="file.png" 添加到 imageView 的属性中。 超级愚蠢,但它有效......

【讨论】:

  • 如何手动添加图片?我试图在属性窗口中写入,但没有任何反应
  • @GabrielPellegrini 如果图像已经在资产文件夹中,只需通过文本或 xml 编辑器(打开方式...)打开情节提要并插入 image="yourfile.png" 进入图像的属性。
【解决方案2】:

代码如下

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="280">
        <dependencies>
            <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
            <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
        </dependencies>
        <scenes>
            <!--View Controller-->
            <scene sceneID="279">
                <objects>
                    <viewController id="280" sceneMemberID="viewController">
                        <layoutGuides>
                            <viewControllerLayoutGuide type="top" id="277"/>
                            <viewControllerLayoutGuide type="bottom" id="278"/>
                        </layoutGuides>
                        <view key="view" contentMode="scaleToFill" id="281">
                            <rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                            <subviews>
                                <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="284" translatesAutoresizingMaskIntoConstraints="NO" fixedFrame="YES">
                                    <rect key="frame" x="87" y="304" width="240" height="128"/>
                                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                </imageView>
                            </subviews>
                        </view>
                    </viewController>
                    <placeholder placeholderIdentifier="IBFirstResponder" id="282" userLabel="First Responder" sceneMemberID="firstResponder"/>
                </objects>
                <point key="canvasLocation" x="271" y="359"/>
            </scene>
        </scenes>
        <color key="tintColor" colorSpace="calibratedWhite" white="1" alpha="1"/>
    </document>

【讨论】:

  • 不知道为什么它的问题,但您可以在 之后和 之前手动插入以下
  • 不用说更改本文中的图像大小
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-05
  • 2016-06-15
  • 2019-10-20
相关资源
最近更新 更多