Pritesh Raiyani
Pritesh Raiyani

Reputation: 313

Custom Keyboard Height and add custom view over custom keyboard in ios

I am going to make a custom keyboard for my app and also implement custom keyboard extension for enhance my application feature at input level,
So i want add "custom view" over my custom keyboard in my app. when i am typing some word at that time add custom view over custom keyboard like gBoard, so how can add custom view and increase size of keyboard more then 216.

Upvotes: 1

Views: 1072

Answers (2)

Marat Ibragimov
Marat Ibragimov

Reputation: 1084

you should put this height constraint into viewWillAppear

 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];

NOTE

In iOS 8.0, you can adjust a custom keyboard’s height any time after its primary view initially draws on screen.

Upvotes: 4

KrishnaCA
KrishnaCA

Reputation: 5695

Adding a custom view over custom keyboard can be done in the same way you do it in your app. For increasing the height of custom keyboard more than 216, you need to add a height constraint to your inputView in KeyboardViewController. It can be done in the following way:

let constraintForHeight:NSLayoutConstraint = NSLayoutConstraint(item: self.inputView, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 0, constant: height)
constraintForHeight.priority = UILayoutPriorityDefaultHigh

self.inputView.addConstraint(constraintForHeight)

Feel free to suggest edits to make this better. Please let me know if there is any problem with implementation

Upvotes: 0

Related Questions