1

Is there a way to make the right side of a UITextField's content "end sooner" like in this graphic:

enter image description here

I'm using the following to give the content text some left padding, but can't figure out an easy solution to reduce the available content size on the right size: self.textfield.layer.sublayerTransform = CATransform3DMakeTranslation(10, 0, 0);

I'd rather not subclass UITextField but I'm fine doing so if need be.

Apollo
  • 8,874
  • 32
  • 104
  • 192
  • possible duplicate of [Set padding for UITextField with UITextBorderStyleNone](http://stackoverflow.com/questions/3727068/set-padding-for-uitextfield-with-uitextborderstylenone) – Kreiri Aug 01 '15 at 04:13
  • @Kreiri isn't that for left padding? – Apollo Aug 01 '15 at 04:26

1 Answers1

0

try these... i hope it helps..

UITextField *txt=[[UITextField alloc]initWithFrame:CGRectMake(10, 100, 150, 30)];
[txt setBackgroundColor:[UIColor lightGrayColor]];
[txt setPlaceholder:@"Hello my friend"];
[self.view addSubview:txt];

UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(10, 100, 50, 30)];
txt.rightView = paddingView;
txt.rightViewMode = UITextFieldViewModeAlways;
krushnsinh
  • 874
  • 1
  • 10
  • 11