首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在UIActionSheet中,键盘不适用于UITextField

在UIActionSheet中,键盘不适用于UITextField
EN

Stack Overflow用户
提问于 2013-02-11 19:01:07
回答 1查看 418关注 0票数 0

此时将显示操作表,并显示我单击的文本字段中的textfield.when,出现键盘但无法正常工作我键入的means..when在文本字段中看不到

代码语言:javascript
复制
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];

请把我从这个问题中拉出来..提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2013-03-06 20:41:13

我发现,当您将UITextField添加到UIActionSheet时,UITextField仍然位于UIActionSheet之下,因此您需要将UITextField显示在UIActionSheet之上

为add UITextField编写以下代码

代码语言:javascript
复制
UIWindow *appWindow = [UIApplication sharedApplication].keyWindow;
[appWindow insertSubview:txtReminderTitle aboveSubview:menu];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14810888

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档