Клавиатура не работает для UITextField в UIActionSheet

Таблица действий отображается с текстовым полем. Когда я нажимаю на текстовое поле, появляется клавиатура, но она не работает. Когда я набрал текст, они не видны в текстовом поле.

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];

Пожалуйста, вытащите меня из этой проблемы.. Заранее спасибо.

1 ответ

Я нашел это, когда вы добавляете UITextField в UIActionSheet затем UITextField это оставаться под UIActionSheet так что вам нужно отобразить UITextField выше UIActionSheet

Написать следующий код для добавления UITextField:

UIWindow *appWindow = [UIApplication sharedApplication].keyWindow;
[appWindow insertSubview:txtReminderTitle aboveSubview:menu];
Другие вопросы по тегам