LoginSignup
2
1

More than 5 years have passed since last update.

カスタムキーボードで端末の向きを判定

Posted at

カスタムキーボードで端末の向きを判定するTIPS

カスタムキーボード内ではUIDevice のorientation の値がうまく使えないため、ちょっと工夫が必要。

isPortrait
// 端末の向き判定
-(BOOL)isPortrait{
    return ([UIScreen mainScreen].bounds.size.width < [UIScreen mainScreen].bounds.size.height);
}

上記メソッドをUIInputViewController を継承したクラス内に追加すれば端末の状態の判定が可能。

参考:How to detect Orientation Change in Custom Keyboard Extension in iOS 8?

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1