0

The text inside the UITextView sits in the middle like so:

enter image description here

But I would like to place at the top left, rather than hovering somewhere in the middle. Not sure why it happens.

tried using

textView.layer.sublayerTransform = CATransform3DMakeTranslation(x, y, z)

But it didn't change anything

Edit: The actual margin appears because of the navbar at the top. I guess it's just like the problem that occurs with a tableview when theres a 64 pixel margin. How can I remove the margin?

Janmenjaya
  • 4,083
  • 1
  • 21
  • 39
luke
  • 2,645
  • 4
  • 15
  • 40

2 Answers2

0

Use :

youtextView.contentInset = UIEdgeInsetsMake(-7.0,0.0,0,0.0); 

If you're having issues with iOS7 or above, try using...

[yourTextView setContentOffset: CGPointMake(x,y) animated:BOOL];
Kampai
  • 22,335
  • 20
  • 91
  • 93
shikha kochar
  • 163
  • 1
  • 7
0

Fixed: setup the textview inside viewWillLayoutSubviews rather than viewDidLoad

luke
  • 2,645
  • 4
  • 15
  • 40