UIWindow frame in ios 8 different from ios 7 in Landscape
Asked Answered
O

2

8

I've create simple module where I add subview to UIWindow. In simulator ios 7(Xcode 5.1.1) I have printed self.windows and I get:

<UIWindow: 0x8db1670; frame = (0 0; 768 1024); autoresize = W+H; gestureRecognizers = <NSArray: 0x8db1a70>; layer = <UIWindowLayer: 0x8db17d0>>

but on ios8 (Xcode 6 beta 6) I get:

<UIWindow: 0x794320d0; frame = (0 0; 1024 768); gestureRecognizers = <NSArray: 0x79437a80>; layer = <UIWindowLayer: 0x7943c400>>

The question is: why there is a difference in frame property?

Odessaodetta answered 9/9, 2014 at 9:59 Comment(1)
have look here, #24150859Rerun
D
11

Probably in your AppDelegate you initializing your UIWindow like this

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

Prior to iOS8 the bounds property of UIScreen returned the bounding rectangle of the physical screen (that is, portrait), but starting from iOS8 bounds changes when the device rotates documentation.

You can now use nativeBounds instead if you'd like to get the bounding rectangle of the physical screen.

Note: nativeBounds returns the screen in pixels but bounds returns it in points.

Daze answered 23/9, 2014 at 14:5 Comment(0)
H
0

My solution for this issue was just to ignore the:

CGAffineTransformMakeRotation

on iOS8 and now everything works for me! thanks :)

Henton answered 6/10, 2014 at 9:36 Comment(2)
and how might you do that?Elm
Not the most helpful of answers. Care to elaborate?Livy

© 2022 - 2024 — McMap. All rights reserved.