UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 300, 28)];
tf.borderStyle = UITextBorderStyleRoundedRect;
[self.view addSubview:tf];
tf.placeholder = @"说点什么";
tf.textAlignment = NSTextAlignmentRight;
关键代码
tf.textAlignment = NSTextAlignmentRight;