UIInputView-Höhe kann nicht geändert werden

Ich habe eine einfache UIInputViewController-Unterklasse mit nur zwei überschriebenen Methoden. Ich benutze diesen Input View Controller alsinputAccessoryViewController auf meiner UIViewController-Unterklasse, die zum ersten Antworter wird. Ich versuche, die Höhe von inputView festzulegen, indem ich eine Einschränkung hinzufüge, wie in der Apple-Dokumentation empfohlen. Problem ist, dass meine Einschränkung nicht funktioniert und ich eine Autolayout-Ausnahme erhalte, wenn meine Einschränkung hinzugefügt wird

Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
...
(
    "<NSLayoutConstraint:0x178aa1d0 V:[UIInputView:0x178a4ae0(0)]>",
    "<NSLayoutConstraint:0x178b9520 V:[UIInputView:0x178a4ae0(500)]>"
)
Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x178b9520 V:[UIInputView:0x178a4ae0(500)]>

Was meiner Meinung nach bedeutet, dass das System der Eingabeansicht bereits eine Höhenbeschränkung von Null hinzugefügt hat (weil sie mit einer Höhe von Null erstellt wurde). Jetzt kommt es zu Konflikten und das automatische Layout bricht meine Einschränkung, um das Problem zu beheben.

Wenn ich versuche, es als @ zu verwendinputViewController meines View Controllers (nur zu Testzwecken), ich bekomme die gleiche Ausnahme, aber anstelle von Null Höhe ist es 216 px. Es bricht auch meine Einschränkung und die Höhe bleibt Standard.

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    self.inputView.translatesAutoresizingMaskIntoConstraints = NO;
    self.inputView.backgroundColor = [UIColor redColor];
}

- (void)updateViewConstraints {

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

    [super updateViewConstraints];
}

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [self.view setNeedsUpdateConstraints];
}

Als Ergebnis kann ich die Höhe der Ansicht für das Eingabezubehör nicht ändern. Hat es jemand geschafft? Die Dokumentation von Apple bietet offensichtlich keine Hilfe ...

Antworten auf die Frage(4)

Ihre Antwort auf die Frage