0

I implementing custom keyboard for ios devices. i build a layout for english qwerty and load it when the view is loaded

self.keyboard = [[[NSBundle mainBundle] loadNibNamed:@"Keyboard" owner:nil options:nil] objectAtIndex:0];
self.inputView = (UIInputView*)self.keyboard;

i need to add a option to change the layout for 3x4 Keyboard with different layout and size of height.

How can i change the layout after for example button click?

Thanks

This is what i try:

self.keyboardSmall = [[[NSBundle mainBundle] loadNibNamed:@"KeyboardSmall" owner:self options:nil] objectAtIndex:0];
    self.inputView = (UIInputView*)self.keyboardSmall;

    _heightConstraint = [NSLayoutConstraint constraintWithItem: self.view
                                                     attribute: NSLayoutAttributeHeight
                                                     relatedBy: NSLayoutRelationEqual
                                                        toItem: nil
                                                     attribute: NSLayoutAttributeNotAnAttribute
                                                    multiplier: 0.0
                                                      constant: 10.0];

    [self.inputView addConstraint: _heightConstraint];

But it is load me a new view (for example just one row) with height of previews view(3 rows) , very spread.

user3428151
  • 449
  • 6
  • 23

1 Answers1

0

From your question, it looks that you are having your custom keyboard just a simple UIView.

Now for changing the height of that view, you need to have one fixed height constraint in your autolayout of view, now you need make IBOutlet of height constraint on custom UIView object. Then whenever you want to change the height of that view, you just need to change the constant value of the IBoutlet of height constratint.

Mehul Thakkar
  • 12,440
  • 10
  • 52
  • 81