How to move to next textfield using keyboardtype numberandpunctuation using textfield notification

Posted by Rani on Stack Overflow See other posts from Stack Overflow or by Rani
Published on 2010-04-13T08:20:27Z Indexed on 2010/04/13 8:22 UTC
Read the original article Hit count: 514

Filed under:

Hi guys,

I am having code

ItemsController.h

    UITextField* quantity;
 UITextField* rate;
 UITextField* tax2;

ItemController.m

    quantity=[[UITextField alloc]initWithFrame:CGRectMake(158,10.5,140,30)];

quantity.textColor = [UIColor blackColor]; quantity.font = [UIFont systemFontOfSize:15.0]; quantity.backgroundColor = [UIColor clearColor]; quantity.returnKeyType=UIReturnKeyNext; quantity.keyboardType = UIKeyboardTypeNumbersAndPunctuation; quantity.leftViewMode = UITextFieldViewModeAlways; quantity.delegate = self;

rate=[[UITextField alloc]initWithFrame:CGRectMake(158,10.5,140,30)]; rate.textColor = [UIColor blackColor]; rate.font = [UIFont systemFontOfSize:15.0]; rate.backgroundColor = [UIColor clearColor]; rate.returnKeyType=UIReturnKeyNext; rate.keyboardType = UIKeyboardTypeNumbersAndPunctuation; rate.leftViewMode = UITextFieldViewModeAlways; rate.delegate = self;

tax2=[[UITextField alloc]initWithFrame:CGRectMake(158,10.5,140,30)]; tax2.textColor = [UIColor blackColor]; tax2.font = [UIFont systemFontOfSize:15.0]; tax2.backgroundColor = [UIColor clearColor]; tax2.returnKeyType=UIReturnKeyDone; tax2.keyboardType = UIKeyboardTypeAlphabet; tax2.leftViewMode = UITextFieldViewModeAlways; tax2.delegate = self;

- (BOOL)textFieldShouldReturn:(UITextField*)textField
 {

if(textField==quantity) {

[rate becomeFirstResponder]; } if(textField == rate) {

[tax2 becomeFirstResponder];

}

else if(textField==tax2) {

[textField resignFirstResponder];

} return YES; }

Using UITextfield notifications while I am moving from quantity textfield to rate textfield the keyboard type is alphabetical its getting actually I gav eit has Number and punctuation why I am not getting.

can any one help me to solve this as soon as possible.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about objective-c