This example for you to share the iOS custom keyboard switching code, for your reference, the specific content as follows
The specific code is as follows
-(void) viewdidload {[Super viewdidload];
Do no additional setup after loading the view, typically from a nib.
Self.title = @ "Small flying brother keyboard";
Self.textfield = [[Uitextfield alloc] Initwithframe:cgrectmake (+, kScreenWidth-100, 50)];
Self.textField.delegate = self;
Self.textField.backgroundColor = [Uicolor Greencolor];
Self.textField.placeholder = @ "(default system Keyboard)";
[Self.view AddSubview:self.textField];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initwithtarget:self action: @selector (Hidenkeyboard)];
[Self.view Addgesturerecognizer:tap];
Uisegmentedcontrol *segment = [[Uisegmentedcontrol alloc] initwithitems:@[@ "Keyboard 1", @ "Keyboard 2", @ "Keyboard 3", @ "System keyboard"];
Segment.frame = CGRectMake (0, Kscreenwidth, 50);
[Segment Addtarget:self Action: @selector (keyboardtypeaction:) forcontrolevents:uicontroleventvaluechanged];
[Self.view addsubview:segment]; }-(void) Keyboardtypeaction: (ID) Sender {uisegmentedcontrol *seg = (Uisegmentedcontrol *)Sender
NSLog (@ "intage =%ld", (long) seg.selectedsegmentindex);
if (Seg.selectedsegmentindex = = 0) {Self.xfg_keyboard = [[Xfg_keyboard alloc] initwithnumber:@1];
Self.textField.inputView = Self.xfg_keyboard;
Self.xfg_keyboard.delegate = self;
[Self.textfield Reloadinputviews];
} if (Seg.selectedsegmentindex = = 1) {Self.xfg_keyboard = [[Xfg_keyboard alloc] initwithnumber:@2];
Self.textField.inputView = Self.xfg_keyboard;
Self.xfg_keyboard.delegate = self;
[Self.textfield Reloadinputviews];
} if (Seg.selectedsegmentindex = = 2) {self.xfg_keyboard = [[Xfg_keyboard alloc] initwithnumber:@3];
Self.textField.inputView = Self.xfg_keyboard;
Self.xfg_keyboard.delegate = self;
[Self.textfield Reloadinputviews];
} if (Seg.selectedsegmentindex = = 3) {Self.textField.inputView = nil;
[Self.textfield Reloadinputviews];
}
}
The above is the entire content of this article, I hope to learn about the iOS program to help.