开发者

wanted few properties regarding UITextField

hello guys i have taken a UITextfield in my application whose capacity is one(max length allowed is one). i implemented it as desired but when i click in the textField the cursor doesn't seems to be at centre(its looking towards top of the cell). i declared a property to set the text alignment to center for the textfield.is there any other property to be set?

my other requirement is the text entered by the user should be automatically converted to CAPITALS by default,i assigned the predefined property :

cellTextField.autocapitalizationType=UITextAutocapitalizationTypeAllCharacters;

but not working.can someone help me in bo开发者_JS百科th aspects if possible.

TNQ in advance


Please go through this to get information on why the is looking towards the top of the cell.

For all letters to be entered in upper case, I would suggest you to go through:

UITextInputTraits protocol (adopted by UITextField)

You could also go through this thread for more details. I hope I answered your questions.


To make text converted to capital, make the textField delegate as self and add the following code:

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


    [textField resignFirstResponder];

    NSString *string = textField.text;

    string = [string uppercaseString];

    textField.text = string;



    return YES;

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜