【发布时间】:2014-10-14 21:49:15
【问题描述】:
我想在 XCode 6 Beta 5 中更改键盘的高度。我搜索了代码,发现使用NSLayoutConstraint,我们可以更改它的高度,但对我不起作用。
这是我的代码:
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];
【问题讨论】:
-
我将此代码放在 viewDidAppear 和 keypress 方法中,但对我也不起作用
-
@lkambad ,如果您使用 xcode beta 3 或 beta 4,我认为它不会发生。即使我尝试过,但高度没有变化。有些在 beta 5 和 beta 6 上取得了成功。
-
@codeIgnitor 我记下我使用的是 xcode 6 beta 5....但不工作
-
@codeIgnitor 还有很多其他用户遇到同样的问题只需访问stackoverflow.com/questions/25486802/…
标签: ios objective-c iphone keyboard