What can make the UIImageView show / display only half of the loaded image?

When navigating through the app, the header has a logo that, depending on the section, loads the header image. For testing, I always use the same image file at the moment, however ... by calling the same method to change the uiimageview image (passing the uiimageview as a parameter), I sometimes only get half of the image that is displayed ... I thought at first it was possibly a frame or frames cutting it, but setting clipstobounds, backgroundcolor to blue and writing the frame / borders shows that this is not the case as far as I can tell. This happens sporadically, so the same code sometimes loads the full image, sometimes only half.

Here is the code I'm using:

rightLogo.Image = null;
rightLogo.ClipsToBounds = false;
rightLogo.BackgroundColor = UIColor.Blue;
UIImage imageTest = UIImage.FromFile (path);
if (imageTest != null)
    imageView.Image = imageTest;

      

Image borders / frames are always set to 90 from what the magazines tell me, the image is 180 high (for retina), content mode is set to scale aspect ...

To add to this: I found that to scale it, the image always displays the full image. Wondering if the problem is with the scaled aspect of fit / full (tried both) by calling this. I have tested both iPad 3 with ios7 and iPad 2 with iOS6 and also the simulator.

+3


source to share


1 answer


Go to "Product" in the xcode navigation bar and select "Clean" or you can press the "UP +" + "K" key.

Then remove the app from the simulator.

This should help it work properly.



or

In the storyboard, select your UIImage, and in the Size Inspector, go to Content Compression Resistance and change the value to 100 both horizontally and vertically.

+3


source







All Articles