tags:

views:

147

answers:

2

Normal UItextField displays a keyboard which includes alpha+Numberic+specials

But I need alpha only...

I need this because if user enters something like -- A'bad

it has a char ' -- which is affecting my query .

How we can set only alphabetic keyboard to user?

+1  A: 

This SO post answers your question: http://stackoverflow.com/questions/1117980/uikeyboard-type

Boon
+1  A: 

I think. I got the answer.

in your view controller file .h add delegate

now add following code to .m file

- (BOOL) textField:(UITextField*)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)textEntered
{
    for (int i = 0; i < [textEntered length]; i++) 
    {
        unichar c = [textEntered characterAtIndex:i];
        if (![myCharSet characterIsMember:c]) 
        {
           return NO;
        }
    }
    return YES;

}

sugar