How to Use Auto Layout on IOS8 Keyboard Expansion
Trying to make auto layout work with keyboard expansion. I originally thought I would make the buttons programmatic, but then I realized that it was better to do it with xib due to my requirement and multiple screen sizes.
See the screenshot below for the current configuration I have done. Button 2:
Button 1 and Application Release:
The whole constraint configuration looks like this:
All I am trying to do is make sure the button fills the width of the screen. They can expand in width to fit screen sizes and orientations. Somehow I feel like it is not capable of understanding device width. Do I need to specify something for this?
thank
source to share
Ben Flores' answer did the trick for me too, but I had to put the code viewDidLayoutSubviews
. Otherwise, my keyboard will crash and not show up. Swift version 3:
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
let frameSize = self.view.frame.size
self.mainView.frame = CGRect(x: 0, y: 0, width: frameSize.width, height: frameSize.height)
}
source to share