Reputation:
I'm using UITextView to display a text read from XML file. On click of a button, it will read next entry from XML file and replaces text in text view accordingly. Its working fine. But the trouble is that, some times, the text starts at 0,0 location in text view and some times, its leaving some space at the top of text view and displaying text. How can I force text to align to the top of text view. Also how can I make text view to leave some padding at the top?
Upvotes: 0
Views: 5598
Reputation: 4124
Use this :
self.nameTextView.contentInset = UIEdgeInsetsMake(0,0,0,0);
Upvotes: 1
Reputation: 6536
I have something similar with scrollable images loading based on user input, which may or may not help. Every time the user changes the image I call:
[YourTextView setContentOffset:CGPointZero];
It might help reset the positioning of the text view.
Upvotes: 3