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 trialQuinton Casburn
15,201 PointsHow to change layout of app from portret view to landscape view
I am making an app with a custom keyboard and need it to change in size and position when the user rotates the phone. How can this be accomplished?
2 Answers
Rashii Henry
16,433 PointsIm not sure if you're actually meaning making the app available in both portrait and landscape but just click on the Project Navigator to the far left of Xcode. Then from there, click on the name of your application. (The first one with the Xcode icon next to it) scroll down and you should see option to make it available in portrait or landscape.
In addition to that, when running you app in the simulator and you want to see the changes click on Hardware from the drop down menu, and click which way you'd prefer to rotate it.
I still feel like i haven't fully answered your question, can you elaborate a little bit more?
Quinton Casburn
15,201 PointsI have done that. The problem is the alignment of the keys. When you rotate the device the keys stay in their formation instead of realigning to the new screen size. They don't stay at the original position, they get pushed off screen.
Rashii Henry
16,433 Pointshmm, I've never tried creating a custom keyboard && having the keys to realign themselves to fit the new screen size accordingly.
When you say get pushed off the screen do you mean the whole keyboard is off screen or half of the keys are visible?
I believe i can only offer suggestions.. is there a way to add constraints to the keyboard programmatically if you choose to turn off auto layout for that specific view controller?
Have you asked you question in GitHub to see if there's something similar?
could you give me a scenario when doing what you're trying to do would be useful? Maybe we can take a different approach if we can't vividly create what you're trying to implement.
Im trying to offer as much help as i can.