给数字键盘添加完成按钮

这里面有个问题,在6P上不显示

- (void)addDoneButtonToNumPadKeyboard
{
    UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    if (IOS_8_OR_LATER == 0){
//        doneButton.frame = CGRectMake(0, 3*(self.boardHeight-3)/4.0f, (kScreenWidth-4)/3.0f, (self.boardHeight-3)/4.0f);
//    }else{
//        doneButton.frame = CGRectMake(0, kScreenHeight-(self.boardHeight-3)/4.0f, (kScreenWidth-4)/3.0f, (self.boardHeight-3)/4.0f);
//    }
    if (IOS_8_OR_LATER == 0){
        doneButton.frame = CGRectMake(0, 163, 106, 53);
    }else{
        doneButton.frame = CGRectMake(0, kScreenHeight-53, 106, 53);
    }
    doneButton.backgroundColor = [UIColor redColor];
    doneButton.tag = 100000000;
    doneButton.adjustsImageWhenHighlighted = NO;
    [doneButton setTitle:@"完成" forState:UIControlStateNormal];
    [doneButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];
    
    NSArray *windowArr = [[UIApplication sharedApplication] windows];
    if (windowArr != nil && windowArr.count > 1){
        UIWindow *needWindow = [windowArr objectAtIndex:1];
        UIView *keyboard;
        for(int i = 0; i < [needWindow.subviews count]; i++) {
            keyboard = [needWindow.subviews objectAtIndex:i];
            if(([[keyboard description] hasPrefix:@" 1){
        UIWindow *needWindow = [windowArr objectAtIndex:1];
        UIView *keyboard;
        for(int i = 0; i < [needWindow.subviews count]; i++) {
            keyboard = [needWindow.subviews objectAtIndex:i];
            if(([[keyboard description] hasPrefix:@"

你可能感兴趣的:(给数字键盘添加完成按钮)