Я кодирую пользовательскую клавиатуру, и я хочу настроить высоту. Apple Documentation дает этот код только в Objective-C, знает ли кто-нибудь, как его записать в Swift Language ? Это код от Apple:Настроить customKeyboard height после загрузки представления в swift
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];
Я попытался написать это, но ничего не делает ..:
override func viewDidAppear(animated:Bool) {
super.viewDidAppear(true)
let nib = UINib(nibName: "KeyboardView", bundle: nil)
let objects = nib.instantiateWithOwner(self, options: nil)
view = objects[0] as UIView;
let _viewHeight: CGFloat = 256
let const1 = NSLayoutConstraint(
item:self.view, attribute:.Height,
relatedBy:.Equal, toItem:nil,
attribute:.NotAnAttribute,multiplier:0, constant: _viewHeight)
view.addConstraint(const1)
}
Помогите мне пожалуйста!
Заканчивать этот вопрос: https://stackoverflow.com/questions/24167909/ios-8-custom-keyboard-changing-the-height/25819565#25819565 – skyline75489