Skip to content

ziyilixin/KeyboardProcess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

KeyboardProcess

键盘处理

屏幕截图 image

代码实现

#pragma mark - CFKeyBoardToolDelegate

- (void)keyBoardTool:(CFKeyBoardTool *)tool didClickItem:(CFKeyBoardToolItem)item
{
    if (item == CFKeyBoardToolItemPrevious) {
        NSUInteger currentIndex = 0;
        for (UIView *view in self.view.subviews) {
            if ([view isFirstResponder]) {
                currentIndex = [self.textFieldArr indexOfObject:view];
            }
        }
        currentIndex--;

        [self.textFieldArr[currentIndex] becomeFirstResponder];

        self.toolBar.PreviousItem.enabled = (currentIndex != 0);
        self.toolBar.nextItem.enabled = YES;

    }
    else if (item == CFKeyBoardToolItemNext) {
        NSUInteger currentIndex = 0;
        for (UIView *view in self.view.subviews) {
            if ([view isFirstResponder]) {
                currentIndex = [self.textFieldArr indexOfObject:view];
            }
        }
        currentIndex++;

        [self.textFieldArr[currentIndex] becomeFirstResponder];

        self.toolBar.PreviousItem.enabled = YES;
        self.toolBar.nextItem.enabled = (currentIndex != (self.textFieldArr.count -1));
    }
    else if (item == CFKeyBoardToolItemDone){
        [self.view endEditing:YES];
    }
}

Releases

No releases published

Packages

No packages published