For textfield we use attributes to give outlines to it or some times we place image view behind every textfield for its outline. We can instead use CALayer for it. I am setting an upper outline to a textfield, here is the code:-
CALayer *upper = [CALayer layer];
upper.frame = CGRectMake(10, -1, 300, .5);
upper.backgroundColor = [UIColor lightGrayColor].CGColor;
[youtextfield.layer addSublayer:upper];
Same way you can change frame according to your layout or design.
Happy Coding
0 Comment(s)