Patrick
Patrick

Reputation: 83

Awkward landscape keyboard in portrait?

I'm inserting a view directly into the UIWindow of an application. If the view I was in previously had a keyboard up and was in landscape I sometimes get this view: https://i.sstatic.net/plutA.jpg

I have tried printing out all the details for the UIWindow's layer and all sublayers and none of them appear to have a transform on them. Any idea what could be going wrong here?

Upvotes: 2

Views: 1324

Answers (2)

John Carter
John Carter

Reputation: 2056

Never seen anything like that before, but keyboard orientation seems to be tied to status bar orientation so this might fix the issue

// This Controls KEYBOARD orientation even if you have the status bar hidden
//
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO]; 

Upvotes: 1

jsd
jsd

Reputation: 7703

UIWindow doesn't handle auto-rotation or autoresizing - only UIViewControllers do that. You have to manage the rotation/scale of any views attached directly to the window yourself.

See Orientation in a UIView added to a UIWindow

Upvotes: 0

Related Questions