1. 程式人生 > >iOS:App Extension Keyboard自定義高度

iOS:App Extension Keyboard自定義高度

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];
在viewDidAppear或者WillAppear中加上上面的約束即可