横向键盘问题 - Xcode - Swift
Keyboard Issue in Landscape Orientation - Xcode - Swift
我的 iOS 应用程序有一个共享扩展程序,该扩展程序需要使用键盘。好像我无法控制扩展的视图控制器的方向,所以当设备处于横向模式时,键盘转向侧面,但不在屏幕上。这使得用户在横向模式下无法使用键盘。如何更改键盘在屏幕上的坐标,以及如何检测设备的方向?我对这个问题感到困惑,如有任何反馈,我们将不胜感激。
检测方向:
if(UIDeviceOrientationIsLandscape(UIDevice.currentDevice().orientation))
{
println("landscape")
}
if(UIDeviceOrientationIsPortrait(UIDevice.currentDevice().orientation))
{
println("portrait")
}
检测方向变化(在 UIViewController 中):
override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) {
// your code
}
您可以检测方向变化和您拥有的方向
我的 iOS 应用程序有一个共享扩展程序,该扩展程序需要使用键盘。好像我无法控制扩展的视图控制器的方向,所以当设备处于横向模式时,键盘转向侧面,但不在屏幕上。这使得用户在横向模式下无法使用键盘。如何更改键盘在屏幕上的坐标,以及如何检测设备的方向?我对这个问题感到困惑,如有任何反馈,我们将不胜感激。
检测方向:
if(UIDeviceOrientationIsLandscape(UIDevice.currentDevice().orientation)) { println("landscape") } if(UIDeviceOrientationIsPortrait(UIDevice.currentDevice().orientation)) { println("portrait") }
检测方向变化(在 UIViewController 中):
override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) { // your code }
您可以检测方向变化和您拥有的方向