ios8 一直存在一个预UIwindow并存的 Window
使用debug view hierarchy.
可以清楚看到一般的键放在一个UIImage view 上,特俗键 是UIKbKeyView
激活输入时
会出现一个UIKeyboradPredictionView 含有3个UIKeyboradPredictionCell 3个符合它的大小设计
ios7 中
- (UIView *)keyboardView
{
UIWindow* tempWindow;
//Because we cant get access to the UIKeyboard throught the SDK we will just use UIView.
//UIKeyboard is a subclass of UIView anyways
UIView* keyboard;
NSLog(@"windows %d", [[[UIApplication sharedApplication]windows]count]);
//Check each window in our application
for(int c = 0; c < [[[UIApplication sharedApplication] windows] count]; c ++)
{
//Get a reference of the current window
tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:c];
//Get a reference of the current view
for(int i = 0; i < [tempWindow.subviews count]; i++)
{
keyboard = [tempWindow.subviews objectAtIndex:i];
NSLog(@"view: %@, on index: %d, class: %@", [keyboard description], i, [[tempWindow.subviews objectAtIndex:i] class]);
if([[keyboard description] hasPrefix:@"(lessThen)UIKeyboard"] == YES)
{
//If we get to this point, then our UIView "keyboard" is referencing our keyboard.
return keyboard;
}
}
for(UIView* potentialKeyboard in tempWindow.subviews)
// if the real keyboard-view is found, remember it.
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
if([[potentialKeyboard description] hasPrefix:@"<UILayoutContainerView"] == YES)
keyboard = potentialKeyboard;
}
else if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 3.2) {
if([[potentialKeyboard description] hasPrefix:@"<UIPeripheralHost"] == YES)
keyboard = potentialKeyboard;
}
else {
if([[potentialKeyboard description] hasPrefix:@"<UIKeyboard"] == YES)
keyboard = potentialKeyboard;
}
}
NSLog(@"view: %@, on index: %d", [keyboard description]);
return keyboard;
}
仔细看表情输入
汉字输入
这篇文章
http://fuzhijie.me/shi-guan-shu-ru/
比较出名的第三方键盘
http://www.redmondpie.com/how-to-get-android-like-swiftkey-keyboard-in-any-app-on-iphone/
从iOS8 也有Prediction,
所以开发第三方的键盘 主要目的--特色,安全。
相信 商城,银行类的会推出自己的键盘。