Xamarin.IOS:无法从Images.xcassets加载图像

时间:2016-02-14 04:06:55

标签: ios iphone image xamarin uiimageview

我正在使用 Xamarin Studio ,我有故事板,其中包含 UIImageView ,其属性设置如下:

enter image description here

您可以注意到所选图片被称为UIImageView personImage = new UIImageView { Frame = new CoreGraphics.CGRect (0, 0, 200, 200), Image = UIImage.FromBundle("personalPhoto"), ContentMode = UIViewContentMode.ScaleAspectFill }; this.View.AddSubview (personImage); ,它存在于 Images.xcassets 中,就像这样

enter image description here

但是当我在模拟器中运行应用程序时,图像没有被加载..而 UIImageView 看起来是空的

enter image description here

即使尝试使用此代码以编程方式添加 UIImageView ,它也会给我相同的结果

#!/bin/bash

PATH=/bin:/usr/bin

log_file="/home/pi/logs/Temp_$(date +%Y%m%d).log"
log_file_raw=${log_file/./_raw.}

while read -r -n 12 dozen
do
    echo -n "$dozen" >> $log_file_raw

    date=`date -u +%F@%X`
    key=${dozen:3:4}
    val=${dozen:7}
    val=${val%-}

    case $key in
    TEMP)
        log="$date | Current Temperature: $val ºC"
        csv=/home/pi/cosm/sensor/temperature/cosm.csv
    ;;
    RHUM)
        log="$date | Current Relative Humidity: $val %"
        csv=/home/pi/cosm/sensor/humidity/cosm.csv
    ;;
    BATT)
        log="$date | Current Battery Voltage: $val V"
        csv=/home/pi/cosm/sensor/voltage/cosm.csv
    ;;
    *)
        continue
    ;;
    esac

    echo "$log" >> $log_file
    echo "${date/@/T}Z,$val" >> $csv

    /bin/bash /home/pi/cosm/sensor/upload-cosm.sh > /dev/null 2>&1 &
    echo "$date | Values sent to xively.com" >> $log_file

done < /dev/ttyAMA0

exit 0

所以你知道这是什么问题......请给我一些帮助..

并提前感谢..

1 个答案:

答案 0 :(得分:2)

重新启动iPhone或模拟器,然后重试。

您也可以清理(产品 - &gt;清洁),然后重试