The height of textView will never grow with its contentSize in Xcode 5 & iOS 7.
-
paste the code you're trying for setting height of textview – D-eptdeveloper Sep 25 '13 at 06:16
-
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{} – DIJO JOSEPH Sep 25 '13 at 06:41
-
I have a problem in iOS7 And Xcode 5 I cant present UIpopover: i don't know how to solve it. – DIJO JOSEPH Sep 26 '13 at 10:07
2 Answers
I think you are presenting popOverView using
[popOverView presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:NO];
Please change ArrowDirections from UIPopoverArrowDirectionUp to UIPopoverArrowDirectionAny

- 16
-
Xcode 5 leaves unsupported attribute in xib files even after turned off? Any Helps – DIJO JOSEPH Sep 30 '13 at 05:44
Before X Code 5, to get the contents height of text view we use text view's property contentSize. But its no longer work with new iOS 7.
With iOS 7, we have a different property named textContainer. It gives text container of text view.
Option 1:
You need to replace the following line of code (These line of code set the text view frame according to its content length.)
CGRect frame = _textView.frame;
frame.size.height = _textView.contentSize.height;
_textView.frame = frame;
with
CGRect frame = _textView.frame;
frame.size.height = _textView.textContainer.size.height;
_textView.frame = frame;
_textView.textContainer.size gives the same value which was given by _textView.contentSize earlier.
Option 2:
We can also replace the line of code
CGRect frame = _textView.frame;
frame.size.height = _textView.contentSize.height;
_textView.frame = frame;
with
CGRect frame = _textView.frame;
frame.size.height = [_textView sizeThatFits:CGSizeMake(txtView.frame.size.width, MAXFLOAT)].height;
_textView.frame = frame;
Above lines of code will work with each iOS.

- 562
- 5
- 18