1. 程式人生 > >UITextField 初始游標初始位置如何居右閃爍 佔位符如何居右顯示

UITextField 初始游標初始位置如何居右閃爍 佔位符如何居右顯示

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;