2016-12-06 144 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) 

随意提出编辑以使其更好。请让我知道是否有与实施