I currently have a regular border. I would like to only have a top and bottom border.
How do I accomplish this?
Using the UITextField<
You can also add views to the top and bottom to use as borders.
// Top border
UIView *topBorder = [[UIView alloc]
initWithFrame:CGRectMake(0,
0,
textfield.frame.size.width,
4.0f)];
topBorder.backgroundColor = [UIColor colorWithRed:160/255.0f
green:160/255.0f
blue:160/255.0f
alpha:1.0f];
[textfield addSubview:topBorder];
// Bottom border
UIView *bottomBorder = [[UIView alloc]
initWithFrame:CGRectMake(0,
textfield.frame.origin.y +
textfield.frame.size.height - 4.0f,
textfield.frame.size.width,
4.0f)];
bottomBorder.backgroundColor = [UIColor colorWithRed:160/255.0f
green:160/255.0f
blue:160/255.0f
alpha:1.0f];
[textfield addSubview:bottomBorder];