Mujtaba Fadhil
Mujtaba Fadhil

Reputation: 6116

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 :

enter image description here

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

enter image description here

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

enter image description here

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 ..

Upvotes: 0

Views: 721

Answers (1)

ParadiseDuo
ParadiseDuo

Reputation: 58

Restart your iPhone or Simulator and try again.

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

Upvotes: 2

Related Questions