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
Alexander Certosimo
1,774 PointsUITextView giving me issues in auto layout
Hey all,
So i am having a little bit of an issue with auto layout. I am inserting a TextView into my VC and everything is normal..cursor and text start in top left hand side. As soon as a nav bar is put into the VC, the text in the textview will lower to center on the left hand side, so basically it is just dropping it. I cant figure out what i am doing wrong, or a way to fix this. Any possible solutions? Thanks!
2 Answers
Jay Guyll
3,261 PointsAuto layout is a very finicky thing to workout. The best solution I could advise would be to clear all existing restraints on the view controller, embed your nav bar, and then apply the restraints. Make sure you apply them both horizontally as well as vertically ortherwise an error with be displayed. If it is still not working, completely close Xcode through the finder window. Often times as the program is ran for hours on end, I find it forgetting syntax and other basic functions. The program restart usually fixes it.
Jay Guyll
3,261 PointsHmmm, are you running the beta of the new Xcode? Or have you tried restraining the distance from the nav bar itself?
Alexander Certosimo
1,774 PointsJay,
I found a solution that fixed it.
In the Interface Builder,
Select the view controller which contains the UITextView.
Go to the attribute inspector.
Uncheck "Adjust Scroll View Insets."
This did the trick. Appreciate your help
Alexander Certosimo
1,774 PointsAlexander Certosimo
1,774 PointsJay,
Thanks for the speedy reply. Unfortunately i had no luck. It still wants to stay right smack in the middle. This is very frustrating as it halts my little project i was working on.