lagos lagos - 1 year ago 115
Objective-C Question

UITextView not becoming first responder

I have a

that contains a
. The
is initiated inside a

But when I touch the
box, nothing happens. Neither the keyboard appears nor delegate methods respond to interaction.


noteText = [[UITextView alloc]initWithFrame:CGRectMake(0, 0, 700, 240)];
noteText.layer.borderColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.2].CGColor;
noteText.layer.borderWidth = 2;
[noteText setEditable:YES];
noteText.userInteractionEnabled = YES;
noteText.returnKeyType = UIReturnKeyDone;
noteText.font = [UIFont fontWithName:@"Calibri" size:16];
noteText.textColor = [UIColor blackColor];
[self addSubview:noteText];

Update 1

I removed all other views from the UIViewController, and only put a UITextView in the UIViewController and still not reacting. Neither cursor or keyboard appear.

Answer Source

I found the error.

In one class I categorize the UITextView instead of subclass and set canBecomeFirstResponder to NO.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download