首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UIInputViewController键盘在iOS 8中不显示

UIInputViewController键盘在iOS 8中不显示
EN

Stack Overflow用户
提问于 2014-07-01 14:18:14
回答 2查看 1.6K关注 0票数 3

我创建了自定义键盘。但有时我的键盘不显示在我的iOS8 iPhone5S中

请检查以下代码。我做错了什么。

我的代码:

代码语言:javascript
复制
   // Perform custom UI setup here
self.nextKeyboardButton = [UIButton buttonWithType:UIButtonTypeSystem];

[self.nextKeyboardButton setTitle:NSLocalizedString(@"Next Keyboard", @"Title for 'Next Keyboard' button") forState:UIControlStateNormal];
[self.nextKeyboardButton sizeToFit];
self.nextKeyboardButton.translatesAutoresizingMaskIntoConstraints = NO;

[self.nextKeyboardButton addTarget:self action:@selector(advanceToNextInputMode) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:self.nextKeyboardButton];

NSLayoutConstraint *nextKeyboardButtonLeftSideConstraint = [NSLayoutConstraint constraintWithItem:self.nextKeyboardButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0.0];
NSLayoutConstraint *nextKeyboardButtonBottomConstraint = [NSLayoutConstraint constraintWithItem:self.nextKeyboardButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0.0];



UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
           action:@selector(aMethod:)
 forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(0.0, 0.0, 160.0, 160.0);
[self.view  addSubview:button];


[self.view addConstraints:@[nextKeyboardButtonLeftSideConstraint, nextKeyboardButtonBottomConstraint]];
EN

回答 2

Stack Overflow用户

发布于 2014-07-09 23:10:03

你遵循这些步骤了吗?因为它对我来说是完美的。更多信息,您可以找到here

代码语言:javascript
复制
Use the toolbar to ensure that the active scheme specifies the containing app and an iOS Simulator device.

Choose Product > Run, or click the Play button at the upper left of the Xcode project window.
After the containing app and keyboard build and get installed in the simulator, you see the empty containing app running.

In iOS Simulator, choose Hardware > Home to view Springboard.
Go to Settings > General > Keyboard > Keyboards.
Tap Add New Keyboard.

In the Purchased Keyboards group, tap the name of your new keyboard. A modal view appears with a switch to enable your keyboard.

Tap the switch to enable your keyboard. A warning alert appears.
In the warning alert, tap Add Keyboard to finish enabling your new keyboard. Then tap Done.
Choose Hardware > Home to view Springboard.

In Springboard, pull down to reveal the Spotlight search field.

In the system keyboard, now onscreen, tap and hold the globe key to show the list of enabled keyboards. Then tap on the custom keyboard you just installed.
票数 2
EN

Stack Overflow用户

发布于 2014-07-07 00:11:00

这里也一样!我的结论是,这是iOS8测试版的一个错误,.You可以通过退出键盘显示的应用程序来再次显示键盘,然后重新启动应用程序,然后键盘正常显示。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24503581

复制
相关文章

相似问题

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