Reputation: 2982
I have a UITextField inside a UIPopover. However, no matter what I do, I cant type in it. The UITextField works fine if I use it in the main view controller.
code:
UITextField *usernameTextField=[[UITextField alloc] initWithFrame:CGRectMake(166.0, 847.0, 100.0, 51.0)];
usernameTextField.secureTextEntry=NO;
[usernameTextField setPlaceholder:@"Username"];
[usernameTextField setAutocorrectionType:UITextAutocorrectionTypeNo];
[usernameTextField setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[usernameTextField setClearButtonMode:UITextFieldViewModeAlways];
[usernameTextField setClearsContextBeforeDrawing:YES];
[usernameTextField setUserInteractionEnabled:YES];
[usernameTextField setEnabled:YES];
usernameTextField.borderStyle = UITextBorderStyleRoundedRect;
usernameTextField.textColor = [UIColor blackColor];
usernameTextField.font = [UIFont systemFontOfSize:17.0];
usernameTextField.keyboardType = UIKeyboardTypeDefault;
usernameTextField.returnKeyType = UIReturnKeySearch;
usernameTextField.delegate=self;
[self.view addSubview:usernameTextField];
Any idea, whats wrong ?
Upvotes: 2
Views: 714
Reputation: 830
Is the textfield in its own view with a view controller? If not, you can try that and then initialize the UIPopoverController with the view controller like: [[UIPopOverController alloc] initWithContentViewController: yourViewControllerwithTextField];
Upvotes: 1