UITextField text alignment in iOS 4.2

I have a strange problem.

UITextField *txtField;
txtField.textAlignment = UITextAlignmentCenter;

This code works well in ios 3.0 and 4.0 (the cursor blinks in the center and textAlignment, and the text is also in the center)

However, in ios 4.2, text alignment remains central, but the cursor blinks to the left.

+3
source share
1 answer

works great for me on ios 4.2. the cursor is in the center and suitable for recording.

text = [[UITextField alloc] initWithFrame:CGRectMake(80.0, 8.0, 210.0, 30.0)];
text.clearsOnBeginEditing = YES;
text.delegate = self;
text.borderStyle = UITextBorderStyleRoundedRect;
text.textAlignment = UITextAlignmentCenter;

this is my code

+1
source

Source: https://habr.com/ru/post/1780836/


All Articles