I currently have a regular border. I would like to only have a top and bottom border.
How do I accomplish this?
self.layer.borderColor = [[UIColor colorWithRed:160/255.0f green:160/255.0f blue:160/255.0f alpha:1.0f] CGColor];
self.layer.borderWidth = 4.0f;
One approach I have found works good is using layers. Here's a snippet:
CALayer *bottomBorder = [CALayer layer]; bottomBorder.frame = CGRectMake(0.0f, self.frame.size.height - 1, self.frame.size.width, 1.0f); bottomBorder.backgroundColor = [UIColor blackColor].CGColor; [myTextField.layer addSublayer:bottomBorder];
Hope this helps someone.