1

I'm trying to create a custom keyboard in ios8, using KeyboardViewController, but something seems wrong ——

  1. When I try to get the height of the keyboard in viewDidLoad, I found that self.view.frameis {0,0,0,0}.

  2. So I try to define the height of keyboard myself, I try following code in viewDidLoad:

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

But I get this log in XCode output pane:

Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. 

Is that anybody can help me to solve any of this problem? thanks!

Indrajeet
  • 5,490
  • 2
  • 28
  • 43
tianzuo
  • 11
  • 4

0 Answers0