I created a view which consists of one UITableView and one UIScrollView
, now I need to draw a border for the UITableView
so that it can be isolated from the UIScrollView
.
Check out UIView layer property which allows you to define visible border for the view. Try out the following:
#import <QuartzCore/QuartzCore.h>
...
self.yourtableview.layer.borderWidth = 2;
self.yourtableview.layer.borderColor = [[UIColor whiteColor] CGColor];
Also remember to include QuartzCore.framework in your project Frameworks list.
There is another way to set the table boarder.
1.You just add the UIView
whose size is little larger than table view.
Add the table view as a subview of the view.
As, if table view frame size is (2,2,100, 200), then the view size should be (0,0,104,204).
2.Set the backgroundColor
of the view as you want to set for the border color.
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