Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove top padding for text in UITextView Swift

I have a unusual problem. First i have Nav Controller and as a one page i have view controller with top panel for back button. I added uiview and uitextview on it. Then i make all needed constraints and after run and see top padding for text in textview about ~60 px . And i dont really know how to remove it.

  1. I tried:

    textViewUserInput.contentInset = UIEdgeInsetsMake(-50, 5, 5, 5);
    

    it works but value -50 for top inset is not good for different devices and orientation

  2. I also tried:

    textViewUserInput.textContainerInset = UIEdgeInsetsZero;
    textViewUserInput.textContainer.lineFragmentPadding = 0;
    

    doesn't change anything

like image 768
Mike Avatar asked Aug 05 '15 18:08

Mike


1 Answers

In Main.storyboard, select your view controller the one that has the UITextView in and underneath your attributes inspector tab uncheck "Adjust scroll view insets". I had the same problem and that worked for me.

like image 173
Va Lee triback83 Avatar answered Nov 15 '22 07:11

Va Lee triback83