Reputation: 233
I know how to add a border to the tableview using:
myTableview.layer.borderColor = [UIColor redColor].CGColor
myTableview.layer.borderWidth = 3.0f;
Setting the border like this results in a square border around the bounds of the tableview not the bounds of the grouped cells in the tableview. Using a similar idea on the cells makes a square border around the bounds of the cell but not the rounded edges.
There doesnt seem to be any way of changing the seperator width on the cells either. Is it possible to make a border around a grouped tableview?
Upvotes: 0
Views: 5034
Reputation: 233
Thanks for the above, but Ive decided in the end to go with this method for customizing grouped tables:
http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html
Not as programmatic as I would have liked but it does the job brilliantly. Would like to think that this will be something Apple will make easier to implement in future XCode updates.
Upvotes: 0
Reputation: 50727
To use .layer
, make sure you #import <QuartzCore/QuartzCore.h>
. But UITableView
does not have the border properties you are looking for, so unfortunately your code will not work.
You can however either place the UITableView
on a UIImageView
with an image that has a border which would be the easiest solution, or you can use CoreGraphics
to draw out the border which would be a lot more work.
Upvotes: 0
Reputation: 19251
I'm not sure what you're asking. There is a cornerRadius
property on CALayer in iOS 3.0 and later.
Upvotes: 1