djskinner
djskinner

Reputation: 8125

Setting TextField delegate causes keyboard to push view up

I have a UIViewController that will display a fullscreen subview on a button press:

How it should look

As you can see the UI elements only cover the top half so that the keyboard has space to fit underneath neatly. This is how I want it to work.

However, as soon as I try to set the TextField delegate to the ViewController, the screen ends up looking like this:

How it looks once the delegate is set

How is it possible that setting the delegate if affecting the way it is displayed, and how do I get it to behave like I want?

Upvotes: 0

Views: 209

Answers (1)

David Hoerl
David Hoerl

Reputation: 41632

This should work just fine. The subview needs the proper struts and springs set - your view should have no springs, and be attached top/left of the superview. If it still happens try to print out the subview frame and spring/struts values, and the superview frame (your primary view). You should do the superview before the keyboard pops, and you can then see if its changing or just your subview.

Upvotes: 1

Related Questions