2014-10-02 97 views

回答

0

您不要在自定義鍵盤中執行此操作 - inputAccessoryView是應用程序本身(控制輸入文本的文本字段的控件)添加到鍵盤正在使用的上方。如果您需要更高的鍵盤高度,可以使用此代碼(複製自Apple的App Extension Programming Guide):

CGFloat _expandedHeight = 500; // this is the height you want your keyboard to be 
NSLayoutConstraint *_heightConstraint = 
    [NSLayoutConstraint constraintWithItem: self.view 
           attribute: NSLayoutAttributeHeight 
           relatedBy: NSLayoutRelationEqual 
            toItem: nil 
           attribute: NSLayoutAttributeNotAnAttribute 
           multiplier: 0.0 
            constant: _expandedHeight]; 
[self.view addConstraint: _heightConstraint]; 
+0

謝謝。這就說得通了。 – jasonjasonfried 2014-10-02 22:15:43

+0

你好,我使用你的代碼,但不增加customkeyboard的高度。 – 2015-01-05 07:20:37

+0

那麼如何激活inputAccessoryView?使用系統鍵盤,inputaccessoryview似乎工作,但與我的自定義鍵盤,我看不到任何界面來激活inputaccessoryview – LKM 2016-08-06 16:40:40

相關問題