Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating border for uitableview

I am using a uitableview and scrollview in a uiview. How to set a border for table or scrollview?

like image 460
ravoorinandan Avatar asked Nov 26 '10 06:11

ravoorinandan


2 Answers

#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. :)

like image 196
Naveen Thunga Avatar answered Oct 04 '22 19:10

Naveen Thunga


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.

like image 39
Oliver Avatar answered Oct 04 '22 21:10

Oliver