【发布时间】:2014-10-18 12:09:55
【问题描述】:
我正在使用 Swift 为 iOS 8 制作自定义键盘。我对 iOS 开发非常陌生,我自己无法解决这个问题。在 App Extension Programming 在线文档中,Apple 表示您可以在任何自定义键盘启动后更改其高度。他们在 Objective-C 中提供了一个示例,但我使用的是 Swift,到目前为止,我似乎找不到 Swift 版本的代码。
有人可以将这 3 行代码转换成 Swift 或告诉我改变键盘高度的方法吗?
下面是代码行:
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];
【问题讨论】:
-
您可能想查看此问题以了解更多详细信息:stackoverflow.com/questions/24167909/…
标签: ios objective-c iphone swift keyboard