ios - UITextView Content Size too Short -


I have a UITextView that I want to change dependency on my content dynamically.

For some reason textview is always less that its content! Here's the code:

  _textView.text = [NSString stringWithFormat: @ "Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test Test "] CGR Ect frame = _textView.frame; Frame.ize.height = _textView.contentSize.height; _textView.frame = frame;   

And here's the result:

UITxView Lots Small

As you can see, the UITextView (in white) is very small. If I have more or less content there, then there is a slight decrease, i.e.

more Text  less text

I'm sure this is something easy but I work it I can not do this

I was the only problem using the storyboard in iOS 7.

My solution was to add this code:

  cgarte newtext wifreframe = self.textView.frame; NewTextViewFrame.size.width = self.textView.contentSize.width + self.textView.contentInset.right + self.textView.contentInset.left; NewTextViewFrame.size.height = self.textView.contentSize.height + self.textView.contentInset.top + self.textView.contentInset.bottom; Self.textView.frame = newTextViewFrame; In   

viewDidAppear: to see the life cycle method and it was immediately shaped to fit its contents Unfortunately, after seeing the size of this size Which means that the user is doing this.

Example: - (zero) viewDeadapp: (BOOL) animated {[Super Viewedapper: Animated]; Cgarte newtext viframe = self.text Scene.fr; NewTextViewFrame.size.width = self.textView.contentSize.width + self.textView.contentInset.right + self.textView.contentInset.left; NewTextViewFrame.size.height = self.textView.contentSize.height + self.textView.contentInset.top + self.textView.contentInset.bottom; Self.textView.frame = newTextViewFrame; }

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -