Midas
Midas

Reputation: 930

UITextview contentSize increase automatically?

I have a UITextField and UITextView in a view.

The scenario is like this:

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

Answers (2)

Ruchika Gupta
Ruchika Gupta

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

codercat
codercat

Reputation: 23271

before set contentSize use sizeToFit

or refer below links it will help you

iOS7 UITextView contentsize.height alternative

Upvotes: 0

Related Questions