2
votes

Forgive me if there is another answer for this question, but I haven't been able to figure out a good way to search for the problem.

On the iPhone5 simulator my background images are about a point short, despite being the proper size. See screenshot:

enter image description here

My images are all 640px × 1136px .png files, and my image code is below:

backgroundImage1 = [[UIImageView alloc] initWithFrame:frame];
        [backgroundImage1 setContentMode:UIViewContentModeScaleAspectFill];
        [backgroundImage1 setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth];
        [self addSubview:backgroundImage1];

I would try it on my phone, but my certificate is expired, so I can't until the dev center comes back online.

Any ideas?

2

2 Answers

3
votes

change

[backgroundImage1 setContentMode:UIViewContentModeScaleAspectFill];

to

 [backgroundImage1 setContentMode:UIViewContentModeScaleToFill];

so that it fills the entire screen

Hope this helps!

1
votes

This is what I ended up doing:

frame.origin.y -= 10.0f;
frame.size.height += 20.0f;

This filled the screen and under the status bar. I had to adjust some positioning of other things on the page, but it worked. Other better answers are more than welcome! Or just an explanation of what's going on.