Here are some great tutorials on portrait textfield movement.
One
Two
Three
My View, on the other hand, rotates to both portrait and landscape, and in both orientations the keyboard obscures the textfield... Right now, both portrait, and One of the landscape orientations work.
So I'm wondering how I can include both landscape orientations.
Here's what I'm doing:
-(void) keyboardWillShow:(NSNotification *)notif{
if ([serverIP isFirstResponder]){
if (isPortrait && self.view.frame.origin.y >= 0){
[self setViewMovedVertical:YES];
}
else if (!isPortrait && self.view.frame.origin.x >= 0){
[self setViewMovedHorizontal:YES];
}
}
}
To move the view. Here are the corrosponding methods
#define PORTRAIT_KEY_OFF 216
#define LANDSCAPE_KEY_OFF 140
-(void) setViewMovedVertical:(BOOL)movedUp{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
CGRect rect = self.view.frame;
if (movedUp){
rect.origin.y -= PORTRAIT_KEY_OFF;
rect.size.height += PORTRAIT_KEY_OFF;
}
else{
rect.origin.y += PORTRAIT_KEY_OFF;
rect.size.height -= PORTRAIT_KEY_OFF;
}
self.view.frame = rect;
[UIView commitAnimations];
}
-(void) setViewMovedHorizontal:(BOOL)moved{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
CGRect rect = self.view.frame;
if (moved){
rect.origin.x -= LANDSCAPE_KEY_OFF;
rect.size.width += LANDSCAPE_KEY_OFF;
}
else{
rect.origin.x += LANDSCAPE_KEY_OFF;
rect.size.width -= LANDSCAPE_KEY_OFF;
}
self.view.frame = rect;
[UIView commitAnimations];
}
And here's the method to move it back down
-(IBAction) serverIPDone: (UITextField *) sender{
if ([serverIP isFirstResponder]){
if (self.view.frame.origin.y < 0){
[self setViewMovedVertical:NO];
}
if (self.view.frame.origin.x < 0){
[self setViewMovedHorizontal:NO];
}
[serverIP resignFirstResponder];
}
}
Hope you can help! If I've anti-disambiguated (see what I did there?) the question, please let me know!
FINALLY Figured it out!!!!
Here's what was wrong: The origin did indeed change between the two landscape modes. So all you have to do is detect which version of landscape you are in, and add or subtract based on that!
-(IBAction) serverIPDone: (UITextField *) sender{
if ([serverIP isFirstResponder]){
if (self.view.frame.origin.y < 0){
[self setViewMovedVertical:NO];
}
if (self.view.frame.origin.x != 0){
[self setViewMovedHorizontal:NO];
}
[serverIP resignFirstResponder];
}
}
The previous makes sure that the keyboard is unset.
-(void) setViewMovedVertical:(BOOL)movedUp{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
CGRect rect = self.view.frame;
if (movedUp){
rect.origin.y -= PORTRAIT_KEY_OFF;
rect.size.height += PORTRAIT_KEY_OFF;
}
else{
rect.origin.y += PORTRAIT_KEY_OFF;
rect.size.height -= PORTRAIT_KEY_OFF;
}
self.view.frame = rect;
[UIView commitAnimations];
}
-(void) setViewMovedHorizontal:(BOOL)moved{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.4];
CGRect rect = self.view.frame;
if (moved){
if (leftLandscape)
rect.origin.x -= LANDSCAPE_KEY_OFF;
else
rect.origin.x += LANDSCAPE_KEY_OFF;
}
else{
if (leftLandscape)
rect.origin.x += LANDSCAPE_KEY_OFF;
else
rect.origin.x -= LANDSCAPE_KEY_OFF;
NSLog(#"after: %f",rect.origin.x);
}
self.view.frame = rect;
[UIView commitAnimations];
}
The Previous will do the actual movement of the keyboard. I got rid of the resizing, you can add it back in.
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)x
duration:(NSTimeInterval)duration{
if (UIInterfaceOrientationIsPortrait(x)) {
isPortrait = TRUE;
}
else {
isPortrait = FALSE;
leftLandscape = (x == UIInterfaceOrientationLandscapeLeft);
}
}
The Previous will make sure you set the variables isPortrait and leftLandscape correctly.
It took too long, but I'm finally DONE!!!
Related
I have a view like you can see over here.
You can see that I have an header image with below a lot of textfields. Only the UITextfields Adres - Postcode - Gemeente - Tel.nr - Email - BTWnr. are disappearing behind the keyboard.
I have some code, that is working for the UITextfield of Adres. But when I want to implement more it always takes the animation for the UITextfield of Adres.
Here is what I have in code
#define kOFFSET_FOR_KEYBOARD 80.0
#define kOFFSET_FOR_KEYBOARD2 120.0
-(void)keyboardWillShow {
NSLog(#"Keyboard frame now is %f",self.keyboardView.frame.origin.y);
// Animate the current view out of the way
if (self.keyboardView.frame.origin.y >= 198)
{
NSLog(#"keyboardWillShow 1");
[self setViewMovedUp2:NO];
}
else if (self.keyboardView.frame.origin.y < 198)
{
NSLog(#"keyboardWillShow 2");
[self setViewMovedUp:YES];
}
}
-(void)keyboardWillHide {
NSLog(#"Keyboard frame ATM %f",self.keyboardView.frame.origin.y);
if (self.keyboardView.frame.origin.y >= 198)
{
NSLog(#"keyboardWillHide 1");
[self setViewMovedUp:YES];
}
else if (self.keyboardView.frame.origin.y < 198)
{
NSLog(#"keyboardWillHide 2");
[self setViewMovedUp:NO];
}
}
-(void)textFieldDidBeginEditing:(UITextField *)sender
{
if ([sender isEqual:txtAdres])
{
NSLog(#"sender is adres");
//move the main view, so that the keyboard does not hide it.
if (self.keyboardView.frame.origin.y >= 198)
{
[self setViewMovedUp:YES];
}
}
if ([sender isEqual:txtPostcode])
{
NSLog(#"sender is postcode");
//move the main view, so that the keyboard does not hide it.
if (self.keyboardView.frame.origin.y >= 198)
{
[self setViewMovedUp2:YES];
}
}
}
//method to move the view up/down whenever the keyboard is shown/dismissed
-(void)setViewMovedUp:(BOOL)movedUp
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3]; // if you want to slide up the view
CGRect rect = self.keyboardView.frame;
if (movedUp)
{
// 1. move the view's origin up so that the text field that will be hidden come above the keyboard
// 2. increase the size of the view so that the area behind the keyboard is covered up.
rect.origin.y -= kOFFSET_FOR_KEYBOARD;
rect.size.height += kOFFSET_FOR_KEYBOARD;
}
else
{
// revert back to the normal state.
rect.origin.y += kOFFSET_FOR_KEYBOARD;
rect.size.height -= kOFFSET_FOR_KEYBOARD;
}
self.keyboardView.frame = rect;
[UIView commitAnimations];
}
-(void)setViewMovedUp2:(BOOL)movedUp
{
NSLog(#"setViewMovedUp2 called");
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3]; // if you want to slide up the view
CGRect rect = self.keyboardView.frame;
if (movedUp)
{
// 1. move the view's origin up so that the text field that will be hidden come above the keyboard
// 2. increase the size of the view so that the area behind the keyboard is covered up.
rect.origin.y -= kOFFSET_FOR_KEYBOARD2;
rect.size.height += kOFFSET_FOR_KEYBOARD2;
}
else
{
// revert back to the normal state.
rect.origin.y += kOFFSET_FOR_KEYBOARD2;
rect.size.height -= kOFFSET_FOR_KEYBOARD2;
}
self.keyboardView.frame = rect;
[UIView commitAnimations];
}
And in my ViewWillAppear I do this
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(keyboardWillShow)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(keyboardWillHide)
name:UIKeyboardWillHideNotification
object:nil];
Can anybody help me with this ?
Please try to use this one ...I hope it may help you. And you can put your value on 200 in this line where you wanna your textfield.
CGFloat avaliableHeight = applicationFrame.size.height - 200;
- (void)scrollViewToCenterOfScreen:(UIView *)theView
{
CGFloat viewCenterY = theView.center.y;
CGRect applicationFrame = [[UIScreen mainScreen] applicationFrame];
CGFloat avaliableHeight = applicationFrame.size.height - 200;
CGFloat y = viewCenterY - avaliableHeight / 2.0f;
if (y < 0)
{
y = 0;
}
[scrollView setContentOffset:CGPointMake(0, y) animated:YES];
}
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
[self scrollViewToCenterOfScreen:textField];
return YES;
}
i would suggest , use a dropin replacement library TPKeyboardAvoiding which handles all the work for moving the views, when Keyboard is shown, Its a Very easy way of achieving that
I actually came across this problem yesterday. Here's my code:
#define kOFFSET_FOR_KEYBOARD 80.0
//This decides how many pixels to move the view
-(void)keyboardWillShow
{
// Animate the current view out of the way
if (self.view.frame.origin.y >= 0)
{
[self setViewMovedUp:YES];
}
else if (self.view.frame.origin.y < 0)
{
[self setViewMovedUp:NO];
}
}
-(void)keyboardWillHide
{
if (self.view.frame.origin.y >= 0)
{
[self setViewMovedUp:YES];
}
else if (self.view.frame.origin.y < 0)
{
[self setViewMovedUp:NO];
}
}
-(void)textFieldDidBeginEditing:(UITextField *)sender
{
if ([sender isEqual:doNotCover])
{
//move the main view, so that the keyboard does not hide it.
if (self.view.frame.origin.y >= 0)
{
[self setViewMovedUp:YES];
}
}
}
//method to move the view up/down whenever the keyboard is shown/dismissed
-(void)setViewMovedUp:(BOOL)movedUp
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3]; // if you want to slide up the view
CGRect rect = self.view.frame;
if (movedUp)
{
// 1. move the view's origin up so that the text field that will be hidden come above the keyboard
// 2. increase the size of the view so that the area behind the keyboard is covered up.
rect.origin.y -= kOFFSET_FOR_KEYBOARD;
rect.size.height += kOFFSET_FOR_KEYBOARD;
}
else
{
// revert back to the normal state.
rect.origin.y += kOFFSET_FOR_KEYBOARD;
rect.size.height -= kOFFSET_FOR_KEYBOARD;
}
self.view.frame = rect;
[UIView commitAnimations];
}
-(void)setViewMovedUp:(BOOL)movedUp
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3]; // if you want to slide up the view
CGRect rect = self.view.frame;
if (movedUp)
{
// 1. move the view's origin up so that the text field that will be hidden come above the keyboard
// 2. increase the size of the view so that the area behind the keyboard is covered up.
rect.origin.y -= kOFFSET_FOR_KEYBOARD;
rect.size.height += kOFFSET_FOR_KEYBOARD;
}
else
{
// revert back to the normal state.
rect.origin.y += kOFFSET_FOR_KEYBOARD;
rect.size.height -= kOFFSET_FOR_KEYBOARD;
}
}
self.view.frame = rect;
[UIView commitAnimations];
- (void)viewWillAppear:(BOOL)animated
{
// register for keyboard notifications
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(keyboardWillShow)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:#selector(keyboardWillHide)
name:UIKeyboardWillHideNotification
object:nil];
}
- (void)viewWillDisappear:(BOOL)animated
{
// unregister for keyboard notifications while not visible.
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIKeyboardWillHideNotification
object:nil];
}
I made my app detect the orientation on the iPad and readjust it's location position accordingly fine so it works good on portrait and landscape.
my problem in the virtual keyboard method that i have it's not considering the orientation: in portrait once user tap one of the text boxes the method would lift up the view to make room for the keyboard and have the text box visible (not covered) - However when user in landscape and tap a text box the animation would push the view sideways instead of up, as if it's still in portrait. (same if i hold the iPad upside-down it will push my view frame down instead of up)
- (void)textFieldDidBeginEditing:(UITextField *)textField{
CGRect textFieldRect = [self.view.window convertRect:textField.bounds fromView:textField];
CGRect viewRect = [self.view.window convertRect:self.view.bounds fromView:self.view];
CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height;
CGFloat numerator = midline - viewRect.origin.y - MINIMUM_SCROLL_FRACTION * viewRect.size.height;
CGFloat denominator = (MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION) * viewRect.size.height;
CGFloat heightFraction = numerator / denominator;
if (heightFraction < 0.0) {
heightFraction = 0.0;
}
else if (heightFraction > 1.0) {
heightFraction = 1.0;
}
UIInterfaceOrientation orientation =[[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait ||
orientation == UIInterfaceOrientationPortraitUpsideDown) {
animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT * heightFraction);
}
else {
animatedDistance = floor(LANDSCAPE_KEYBOARD_HEIGHT * heightFraction);
}
CGRect viewFrame = self.view.frame;
viewFrame.origin.y -= animatedDistance;
// viewFrame.origin.x -= animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[self.view setFrame:viewFrame];
[UIView commitAnimations];
}
I also have:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
How should i change the method to animate it correctly when the device changes orientation?
Thanks
Detect the orientation and decide which direction to move the view in based on that info.
if ([UIDevice currentDevice].orientation==UIDeviceOrientationLandscapeLeft)
viewFrame.origin.x -= animatedDistance;
if ([UIDevice currentDevice].orientation==UIDeviceOrientationLandscapeRight)
viewFrame.origin.x += animatedDistance;
if ([UIDevice currentDevice].orientation==UIDeviceOrientationPortrait)
viewFrame.origin.y -= animatedDistance;
if ([UIDevice currentDevice].orientation==UIDeviceOrientationPortraitUpsideDown)
viewFrame.origin.y += animatedDistance;
So I have about 7 textfields and 6 of them use a keyboard and the other uses a picker. The problem I'm having is that if the keyboard is open when the textfield that is linked to the picker is touched the keyboard won't dismiss and the picker appears under it. Here's my code
- (void) textFieldDidBeginEditing:(UITextField *)textField
{
pickerView.hidden = YES;
if ([textField isEqual:state])
{
[state resignFirstResponder];
[self textFieldFirstResponderOnDelay1];
}
else
{
pickerView.hidden = YES;
// This movie the view up so textfield isn't hidden by keyboard
CGRect textFieldRect =
[self.view.window convertRect:textField.bounds fromView:textField];
CGRect viewRect =
[self.view.window convertRect:self.view.bounds fromView:self.view];
CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height;
CGFloat numerator =
midline - viewRect.origin.y
- MINIMUM_SCROLL_FRACTION * viewRect.size.height;
CGFloat denominator =
(MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION)
* viewRect.size.height;
CGFloat heightFraction = numerator / denominator;
if (heightFraction < 0.0)
{
heightFraction = 0.0;
}
else if (heightFraction > 1.0)
{
heightFraction = 1.0;
}
UIInterfaceOrientation orientation =
[[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait ||
orientation == UIInterfaceOrientationPortraitUpsideDown)
{
animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT * heightFraction);
}
else
{
animatedDistance = floor(LANDSCAPE_KEYBOARD_HEIGHT * heightFraction);
}
CGRect viewFrame = self.view.frame;
viewFrame.origin.y -= animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[self.view setFrame:viewFrame];
[UIView commitAnimations];
}
}
-(void) viewDidLoad
{
pickerView = [[UIPickerView alloc] init];
pickerView.frame = CGRectMake(0, 245, 320, 216);
pickerView.delegate = self;
pickerView.hidden = YES;
pickerView.showsSelectionIndicator = YES;
state.inputView = pickerView;
[self.view addSubview:pickerView];
}
-(void)textFieldFirstResponderOnDelay1
{
pickerView.hidden=NO;
[pickerView reloadAllComponents];
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
if([textField isEqual:state])
{
}
else
{
CGRect viewFrame = self.view.frame;
viewFrame.origin.y += animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[self.view setFrame:viewFrame];
[UIView commitAnimations];
}
}
Instead of adding the pickerview as a subview of your main window, just set it as the input view for the appropriate textviews, then it will show/hide as the keyboard would normally:
textField.inputView = pickerView;
I am trying to scroll through textarea fields in the view using a next button on top of the keyboard, when it shifts to the last textarea field it's scrolling downwards and hiding behind the keyboard.
code:
(CGRect)getObjectRectFromRoot {
int yOffset = 0;
yOffset += self.view.frame.origin.y;
UIView* suView = self.view.superview;
while (suView) {
yOffset += suView.frame.origin.y;
suView = suView.superview;
}
CGRect r;
r.size.width = 700;
r.size.height = 700;
r.size.width = self.view.frame.size.width;
r.size.height = self.view.frame.size.height;
r.origin.x = 0;
r.origin.y = yOffset;
return r;
}
Implementing this code in the two delegate methods of your textField will do what you want. Here is the textFieldDidBeginEditing:
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
CGRect textFieldRect =
[self.view.window convertRect:textField.bounds fromView:textField];
CGRect viewRect =
[self.view.window convertRect:self.view.bounds fromView:self.view];
CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height;
CGFloat numerator =
midline - viewRect.origin.y
- MINIMUM_SCROLL_FRACTION * viewRect.size.height;
CGFloat denominator =
(MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION)
* viewRect.size.height;
CGFloat heightFraction = numerator / denominator;
if (heightFraction < 0.0)
{
heightFraction = 0.0;
}
else if (heightFraction > 1.0)
{
heightFraction = 1.0;
}
UIInterfaceOrientation orientation =
[[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait ||
orientation == UIInterfaceOrientationPortraitUpsideDown)
{
animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT * heightFraction);
}
else
{
animatedDistance = floor(LANDSCAPE_KEYBOARD_HEIGHT * heightFraction);
}
CGRect viewFrame = self.view.frame;
viewFrame.origin.y -= animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[self.view setFrame:viewFrame];
[UIView commitAnimations];
}
And here is the textFieldDidEndEditing:
- (void)textFieldDidEndEditing:(UITextField *)textField
{
CGRect viewFrame = self.view.frame;
viewFrame.origin.y += animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[self.view setFrame:viewFrame];
[self textFieldShouldReturn:textField];
[UIView commitAnimations];
}
If you want it for the buttons you can just setup an IBAction with the above code.
The code can also be used with any other type of action or view you would like!
I am new to iPhone technology and I want to use TextField, but when I use keyboard I can't use alphanumeric character. It's working only for alphabetic words.
Some functions I have used are below:-
-(BOOL)textFieldShouldReturn:(UITextField *)theTextField {
if(theTextField == txtanswer) {
[txtanswer resignFirstResponder];
}
return YES;
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
CGRect textFieldRect =
//[self.view.window convertRect:textField.bounds fromView:textField];
CGRect viewRect =
//[self.view.window convertRect:self.view.bounds fromView:self.view];
CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height;
CGFloat numerator =
midline - viewRect.origin.y
- MINIMUM_SCROLL_FRACTION * viewRect.size.height;
CGFloat denominator =
(MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION)
* viewRect.size.height;
CGFloat heightFraction = numerator / denominator;
if (heightFraction < 0.0)
{
heightFraction = 0.0;
}
else if (heightFraction > 1.0)
{
heightFraction = 1.0;
}
UIInterfaceOrientation orientation =
[[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait ||
orientation == UIInterfaceOrientationPortraitUpsideDown)
{
animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT * heightFraction);
}
else
{
animatedDistance = floor(LANDSCAPE_KEYBOARD_HEIGHT * heightFraction);
}
CGRect viewFrame = self.view.frame;
viewFrame.origin.y -= animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[self.view setFrame:viewFrame];
[UIView commitAnimations];
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
if(cehc==2)
{
}if(textField == txtanswer)
[txtanswer resignFirstResponder];
return YES;
}
-(IBAction) textFieldDoneEditing : (id) sender{
CGRect viewFrame = self.view.frame;
viewFrame.origin.y += animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[self.view setFrame:viewFrame];
[UIView commitAnimations];
}
- (void)textFieldDidEndEditing:(UITextField *)textField;
{
CGRect viewFrame = self.view.frame;
viewFrame.origin.y += animatedDistance;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
[self.view setFrame:viewFrame];
[UIView commitAnimations];
}
Please help me out to solve this problem
Thanks
Kunal
Does UIKeyboardType in the XCode docs help you (or did I misunderstand your problem)? Note that there seems to be 3 different numeric keyboard types.