2016-12-06 133 views
1

我要做出一個自定義鍵盤爲我的應用程序,並實現自定義鍵盤延長爲提高我的應用程序功能的輸入電平,
所以我想添加「定製添加自定義視圖查看「通過我的自定義鍵盤在我的應用程序。當我在那時輸入一些單詞添加定製視圖超過自定義鍵盤,如gBoard,那麼如何添加自定義視圖,並增加鍵盤的大小超過216。自定義鍵盤高度及以上的自定義鍵盤IOS

+0

我想我沒有得到你的問題。是這樣嗎?請看看答案和評論。 –

回答

3

任何問題,你應該把這個高度約束到viewWillAppear中

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]; 

注意

在iOS中8.0,你可以在任何時間調整後的自定義鍵盤的高度及其主視圖最初在屏幕上繪製。

+0

我正在實現自定義鍵盤擴展,我沒有在我的應用程序中實現。所以你可以請提供你的輸入相關it.Please檢查我的問題,我更新它。 –

+0

我知道,我的意思是您需要在您的自定義鍵盤的UIInputViewController中實現viewWillAppear,self.view實際上是您的自定義鍵盤視圖 –

+0

請參閱以下鏈接: –

0

通過自定義鍵盤添加自定義視圖可以完成相同方式你在你的應用程序中執行。要增加自定義鍵盤的高度超過216,您需要在KeyboardViewControllerinputView中添加高度約束。它可以通過以下方式完成:

let constraintForHeight:NSLayoutConstraint = NSLayoutConstraint(item: self.inputView, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 0, constant: height) 
constraintForHeight.priority = UILayoutPriorityDefaultHigh 

self.inputView.addConstraint(constraintForHeight) 

隨意提出編輯以使其更好。請讓我知道是否有與實施