【发布时间】:2012-04-20 18:14:44
【问题描述】:
我在 UIPopover 中有一个 UITextField。但是,无论我做什么,我都无法输入它。如果我在主视图控制器中使用 UITextField 可以正常工作。
代码:
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];
任何想法,有什么问题?
【问题讨论】:
-
self.view 是否将 userInteractionEnabled 设置为 yes?
-
是的。从代码中可以看出。
-
不,没有与
self的创建相关的代码。 -
您明白我是在询问您添加 textField 的视图,而不是询问 textField,对吧?
标签: objective-c ios uipopovercontroller uipopover