0

操作表与文本字段一起出现。当我单击文本字段时,键盘出现但无法正常工作。当我输入时,它们在文本字段中不可见

UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Select reminder date and time"
                                                  delegate:self
                                         cancelButtonTitle:@"Cancel"
                                    destructiveButtonTitle:@"Save"
                                         otherButtonTitles:nil,nil];
menu.tag =10;
[menu showInView:self.view];
UITextField  *txtReminderTitle= [[UITextField alloc] initWithFrame:CGRectMake(20.0, 190, 280.0, 40.0)];
[txtReminderTitle setTag:99];
[txtReminderTitle setBackgroundColor:[UIColor whiteColor]];
[txtReminderTitle setFont:[UIFont boldSystemFontOfSize:17]];
[txtReminderTitle setBorderStyle:UITextBorderStyleNone];
[txtReminderTitle setTextAlignment:UITextAlignmentCenter];
txtReminderTitle.borderStyle = UITextBorderStyleRoundedRect;
txtReminderTitle.keyboardType = UIKeyboardTypeDefault;
txtReminderTitle.returnKeyType = UIReturnKeyDone;
txtReminderTitle.delegate =self;
[menu addSubview:txtReminderTitle];

请把我从这个问题中解救出来。在此先感谢。

4

1 回答 1

0

我发现,当你添加UITextFieldUIActionSheetthen时UITextField,它仍然在下面,UIActionSheet所以你需要在UITextField上面显示UIActionSheet

为 add 编写以下代码UITextField

UIWindow *appWindow = [UIApplication sharedApplication].keyWindow;
[appWindow insertSubview:txtReminderTitle aboveSubview:menu];
于 2013-03-06T12:41:12.833 回答