简体   繁体   中英

Xamarin.IOS: Can't load image from Images.xcassets

Im working on Xamarin Studio , and I have a Storyboard which contains a UIImageView , its properties are set like this :

在此处输入图片说明

You can notice that chosen image is called personalPhoto which exists in the Images.xcassets like this

在此处输入图片说明

But when I run the app in the simulator, the image isn't loaded .. and the UIImageView looks empty

在此处输入图片说明

Even if try to add the UIImageView programatically using this code.. it gives me the same result

UIImageView personImage = new UIImageView {
    Frame = new CoreGraphics.CGRect (0, 0, 200, 200),
    Image = UIImage.FromBundle("personalPhoto"),
    ContentMode = UIViewContentMode.ScaleAspectFill
};
this.View.AddSubview (personImage);

So do you have any idea what is the problem .. please give me some help ..

And thanks in advance ..

Restart your iPhone or Simulator and try again.

You can also clean (Product -> clean) and try again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM