In order to update your custom keyboard when the orientation changes, override viewDidLayoutSubviews
in the UIInputViewController
. As far as I can tell, when a rotation occurs this method is always called.
Additionally, as the traditional [UIApplication sharedApplication] statusBarOrientation]
doesn't work, to determine the current orientation use the following snippet:
if([UIScreen mainScreen].bounds.size.width < [UIScreen mainScreen].bounds.size.height){
//Keyboard is in Portrait
}
else{
//Keyboard is in Landscape
}
Hopefully this helps!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…