且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在iOS自定义键盘中切换单词选择视图(更改高度)?

更新时间:2022-11-11 16:55:33

It IS possible to change the size of the keyboard in the current iOS 8

Taken verbatim from the documentation: "In iOS 8.0, you can adjust a custom keyboard’s height any time after its primary view initially draws on screen."

To resize your custom keyboard, add a simple layout constraint.

CGFloat _expandedHeight = 500;
NSLayoutConstraint *_heightConstraint = 
    [NSLayoutConstraint constraintWithItem: self.view 
                                 attribute: NSLayoutAttributeHeight 
                                 relatedBy: NSLayoutRelationEqual 
                                    toItem: nil 
                                 attribute: NSLayoutAttributeNotAnAttribute 
                                multiplier: 0.0 
                                  constant: _expandedHeight];
[self.view addConstraint: _heightConstraint];

For more information look at Apple's prerelease documentation here!