gpt4 book ai didi

objective-c - UIPopover 中的 UITextField

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:51:57 24 4
gpt4 key购买 nike

我在 UIPopover 中有一个 UITextField。但是,无论我做什么,我都无法输入。如果我在主视图 Controller 中使用 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];

有什么想法吗?

最佳答案

文本字段是否在其自己的 View 中带有 View Controller ?如果没有,您可以尝试这样做,然后使用 View Controller 初始化 UIPopoverController,例如:[[UIPopOverController alloc] initWithContentViewController: yourViewControllerwithTextField];

关于objective-c - UIPopover 中的 UITextField,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10251362/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com