我将为我的应用程序制作一个自定义键盘,并在输入级别实现自定义键盘扩展以增强我的应用程序功能。
因此,我希望在我的应用程序中在我的自定义键盘上添加“自定义视图”。当我当时键入一些词时,在自定义键盘上添加自定义视图(如gBoard ),那么如何添加自定义视图并增加键盘的大小超过216。
发布于 2016-12-06 07:47:45
您应该将这个高度约束放入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中,您可以在自定义键盘的主视图最初在屏幕上绘制后随时调整其高度。
发布于 2016-12-06 07:32:27
在自定义键盘上添加自定义视图的方式与在应用程序中添加的方式相同。若要将自定义键盘的高度增加到216以上,则需要在inputView中KeyboardViewController中添加高度约束。它可以通过以下方式进行:
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)请随意建议编辑,以使这更好。请告诉我在执行方面是否有任何问题。
https://stackoverflow.com/questions/40989771
复制相似问题