Objective-c – How to set text position to bottom in textField

iphoneobjective cuitextfieldxcode

I created a textField through code using the following code

UITextField *txtObj=[UITextField alloc]initWithFrame:CGRectMake(88,100,80,33)];

I am getting the textfield as i planned, but the text we type in that text field seems to appear in the top area of text but not in bottom.I tried to align it but i got tired. Can anyone tell me what's the solution

Best Answer

it should be:

txtObj.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom;

This property is inherited from the UIControl class. The default is: UIControlContentVerticalAlignmentTop , that's why you get the text on top.