我已经以编程方式创建了一个自定义键盘。没有情节提要。我想按照Apple自己的键盘在上方添加一个附件视图。无法弄清楚如何在我的应用程序的键盘文件中快速执行此操作。
我试过了(row0是UIView):
self.view.inputAccessoryView?.addSubview(row0)
谢谢!
您无需在自定义键盘中执行此操作-这inputAccessoryView
是应用程序本身(控制要在其中输入文本的文本字段的应用程序)添加到正在使用的任何键盘之上的功能。如果您的键盘需要更高的高度,则可以使用以下代码(从Apple的App Extension编程指南中复制):
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];
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句