Reputation: 930
I have a UITextField
and UITextView
in a view.
The scenario is like this:
textFieldShouldReturn
: method of the UITextField
makes UITextView
the firstResponder
And now the problem is , every time my textView becomes the first responder the contentSize
of the UITextView
increases(ie,every time the cursor moves to a new line)..
Is there any way that the textView's contentsize
remains the same???
Thanxx in advance..
Upvotes: 1
Views: 275
Reputation: 96
use this code.This will solve your problem.
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
if([textField isEqual:myTextField])
{
[myTextField resignFirstResponder];
[myTextView becomeFirstResponder];
return NO;
}
return YES;
}
Upvotes: 1
Reputation: 23271
before set contentSize use sizeToFit
or refer below links it will help you
iOS7 UITextView contentsize.height alternative
Upvotes: 0