Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save naokits/6b6e0efb4976b25fc815 to your computer and use it in GitHub Desktop.
Save naokits/6b6e0efb4976b25fc815 to your computer and use it in GitHub Desktop.
2016/1/10 iOSのApp Extensionを利用したキーボードの高さ調整

iOSのApp Extension を利用したキーボード(カスタムキーボード)で高さを調整する

//前もって高さを設定
pHeight=400

//以下の関数をオーバーライド
override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)

    //以下で高さ変更
    let heightConstraint = NSLayoutConstraint(item: view, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 0,constant: pHeight)
    view.addConstraint(heightConstraint)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment