动作表随textfield一起显示。当我点击文本字段时,键盘出现但不起作用..当我输入时,它们在文本字段中不可见
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];
请把我拉出这个问题.. 提前谢谢。
答案 0 :(得分:0)
我发现,当您将UITextField
添加到UIActionSheet
时,UITextField
保留在UIActionSheet
下,因此您需要在UITextField
上方显示UIActionSheet
}
编写以下代码以添加UITextField
:
UIWindow *appWindow = [UIApplication sharedApplication].keyWindow;
[appWindow insertSubview:txtReminderTitle aboveSubview:menu];