UITextField的leftView

这种UITextField实现效果如下:

    UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 45, 21)];   
    lbl.backgroundColor = [UIColor clearColor];
    lbl.textColor = [UIColor lightGrayColor];
    lbl.text = @"Start:";

    UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(50, 100, 150, 31)];
    tf.borderStyle = UITextBorderStyleRoundedRect;
    tf.leftViewMode = UITextFieldViewModeAlways;   
    tf.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    tf.leftView = lbl;

相关文章:

  • 2022-12-23
  • 2021-08-13
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
猜你喜欢
  • 2021-06-05
  • 2022-01-18
  • 2022-01-22
  • 2021-11-16
相关资源
相似解决方案