views:

161

answers:

1

Hi,

I'm loading image in a view's ViewDidLoad() method like this:

imgMonthGraph.Image = UIImage.FromFile("A.png");

(where imgMonthGraph is UIImageView) The above code works.

However, I'd need at a later phase (not inside ViewDidLoad())to load another image to the same UIImageView. I'm tring with this code:

imgMonthGraph.Image = UIImage.FromFile("B.png");

The above code doesn't work because the image is not updated. I've tried running SetNeedsDisplay() -methdod on image, imageview and view. Nothing seems to help.

Something needs to be refreshed, but what?

pom

A: 

try:

using (imgMonthGraph.Image)
{   
    imgMonthGraph.Image = UIImage.FromFile("A.png");
}

works for me :)

cvista