adit
adit

Reputation: 33674

Weird issue with UITextView

I have an issue with my UITextView. Whenever I try to type something the UITextView goes up beyond the frame and I can't seem to do anything. Why is this?

Some screenshots:

when I type in the first word:

enter image description here

then typing another word, it shifts up and I can't see a thing:

enter image description here

Some code:

 self.messageTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 600, 30)];
    [self.messageTextView setAutocorrectionType:UITextAutocorrectionTypeNo];
    [self.messageTextView setAutocapitalizationType:UITextAutocapitalizationTypeNone];
    [self.messageTextView setFont:[UIFont fontWithName:@"ArialMT" size:16.0]];
    self.messageTextView.delegate = self;

Upvotes: 1

Views: 183

Answers (2)

Ayush Goel
Ayush Goel

Reputation: 1103

give a bigger height to your frame

self.messageTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 600, 80)];

Upvotes: 0

EmptyStack
EmptyStack

Reputation: 51374

Did you try, textView.contentInset = UIEdgeInsetsZero;

Upvotes: 1

Related Questions