Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Implementing Designs for iPhone Using Auto Layout and Managing the Keyboard Handling Views Covered by the Keyboard

Charlie O'Shea
Charlie O'Shea
18,737 Points

TPKeyBoardAvoiding: Keyboard not appearing at all on iPhone 5 to 6

I've followed along with the video but the keyboard isn't appearing at all when clicking on textfields in the 4 inch simulators. It works fine in the 4S simulator but doesn't appear in 5, 5S or 6. Although bizarrely it does work in the new 6 Plus simulator.

Any ideas? I used the TPKeyBoardAvoiding files linked to below the video, perhaps these are incompatible with X Code 6? I tried using the current code from the Github but it was throwing loads of errors up.

Edit: I also had problems with getting the background images to work in 4 inch as per this thread [https://teamtreehouse.com/forum/setting-background-images-for-various-screen-sizes-error] so perhaps it is related

1 Answer

Stone Preston
Stone Preston
42,016 Points

make sure you have enabled the software keyboard in the simulator settings

go to

iOS Simulator -> Hardware -> Keyboard

and uncheck "Connect Hardware Keyboard"

that will make it so that the software keyboard is enabled all the time.

you can also toggle between the software keyboard and hardware keyboard by pressing command + k.

I use TPKeyboardAvoiding in my swift projects so it does indeed work.

Charlie O'Shea
Charlie O'Shea
18,737 Points

Yes this did it, thanks so much Stone. Strange that it worked in 4S and 6+ but perhaps I had already unticked that option in those simulators a while ago. Oh if only you knew how long I'd spent trying to work this out.