0

In iOS7 I was able to create a full screen view using the following code:

- (void)loadView {
    CGSize screenSize = [UIScreen mainScreen].bounds.size;
    CGRect frame = CGRectMake(0, 0, screenSize.height, screenSize.width);
    UIView *view = [[UIView alloc] initWithFrame: frame];

    self.view = view;
}

When moving to iOS8 this code does not work properly, the screen is cut off on and scaled on the right side, similar to this:

---------------   ---------------   
|             |   |         |   |
|     iOS7    |   | iOS8    |   |
| Full Screen |   | Cut Off |   |
|             |   |         |   |
|             |   |         |   |
---------------   ---------------

This is affecting all full screen views in my app which are programmatically generated, any ideas here?

turbotux
  • 422
  • 2
  • 11

1 Answers1

0

Instead of:

CGRect frame = CGRectMake(0, 0, screenSize.height, screenSize.width);

You need

CGRect frame = CGRectMake(0, 0, screenSize.width, screenSize.height);

Its:

CGRect CGRectMake ( CGFloat x, CGFloat y, CGFloat width, CGFloat height ); 
Grzegorz Krukowski
  • 18,081
  • 5
  • 50
  • 71
  • This worked thanks!, However any thoughts on why this worked OK in iOS7? I should have noted that the app is landscape mode. – turbotux Nov 30 '14 at 15:43
  • 1
    On iOS UIScreen is now interface oriented, check this for more http://stackoverflow.com/questions/24150359/is-uiscreen-mainscreen-bounds-size-becoming-orientation-dependent-in-ios8 – Grzegorz Krukowski Nov 30 '14 at 15:47