I am using a uitableview and scrollview in a uiview. How to set a border for table or scrollview?
#import "QuartzCore/QuartzCore.h"
then in viewDidLoad
use,
tableView.layer.borderWidth = 2.0;
Note
You can also set the border color:
tableView.layer.borderColor = [UIColor redColor].CGColor;
It should work for you. :)
This works quite well for me:
CALayer *layer = _tableView.layer; [layer setMasksToBounds:YES]; [layer setCornerRadius: 4.0]; [layer setBorderWidth:1.0]; [layer setBorderColor:[[UIColor colorWithWhite: 0.8 alpha: 1.0] CGColor]];
The rounded borders look a little more iOS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With