2017-07-13 6 views
1


のヘルプが必要です私はこの1つGitHub of My First Custom Keyboard、カスタムキーボードを作る:は、カスタムキーボード

enter image description here

が、それは非常にタイトに見えます。
私はそれを大きくするための方法を検索しましたし、私はそれが私のカスタムキーボード上では動作しません

var heightConstraint: NSLayoutConstraint! 

override func updateViewConstraints() { 
    super.updateViewConstraints() 
    let customHeight = UIScreen.main.bounds.height/2 

    if heightConstraint == nil { 
     heightConstraint = NSLayoutConstraint(item: view, 
               attribute: .height, 
               relatedBy: .equal, 
               toItem: nil, 
               attribute: .notAnAttribute, 
               multiplier: 1, 
               constant: customHeight) 
     heightConstraint.priority = UILayoutPriority(UILayoutPriorityRequired) 
     print("Setuped") 
     view.addConstraint(heightConstraint) 
    } 
    else { 
     print("2") 
     heightConstraint.constant = customHeight 
    } 
} 

しかし、何もそれほど起こらない私は、このQuestion
リンクから作られた大きなカスタムキーボードをダウンロードしていることがわかりました:GitHub of Downloaded Keyboard

enter image description here

このキーボードは完璧な高さを持っているが、私は彼がもう動作しないボタンを追加するとき:/ GitHub of Edited by me Downloaded Keyboard
誰かが私の最初のカスタムキーボードの背を高くしたり、ダウンロードしたキーボードにボタンを追加したりすることができます。

+0

カスタムキーボードビューでは、translatesAutoResizingMaskToConstraints = NOを設定してみてください。 – Brandon

+0

@Brandonも何も起こらない:/ – Rombond

答えて

0

toItem: nilをトップスーパービューに変更するとどうなりますか?

+0

何も起こらない:( – Rombond

関連する問題