iOS8 系统键盘分析 ,与第三方键盘

ios8 一直存在一个预UIwindow并存的 Window 

使用debug view hierarchy.


在ios8 中系统键盘 是UIInputSetHostView  它是UIInputSetContainerView 的子图




可以清楚看到一般的键放在一个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,

所以开发第三方的键盘 主要目的--特色,安全。

相信 商城,银行类的会推出自己的键盘。




评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值