簡體   English   中英

UIInputViewController鍵盤未在iOS 8中顯示

[英]UIInputViewController keyboard not displaying in iOS 8

我創建了自定義鍵盤。 但有些時候我的鍵盤沒有顯示在我的iOS8 iPhone5S中

請檢查以下代碼。 我做錯了什么。

我的代碼:

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

你按照這個步驟了嗎? 因為它適合我。 你可以在這里找到更多

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.

和這里一樣 ! 我得出結論,這是iOS8測試版的一個錯誤。您可以通過退出鍵盤顯示的應用程序再次顯示鍵盤,然后重新啟動應用程序,然后鍵盤正常顯示。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM