Adding Rounded Corners to UIView without breaking interactions.
-
20-06-2021 - |
Question
This answer works great, Adding Rounded Corners to only top of UITableView? except my UIBarButtonItems are no longer clickable. My guess is that the mask is now sitting on top of the buttons breaking the interaction.
Does anyone have any ideas to implement this without interfering with the rest of the view?
Solution
Have you tried just masking your tableView's
layer:
CAShapeLayer * maskLayer = [CAShapeLayer layer];
maskLayer.path = [UIBezierPath bezierPathWithRoundedRect: self.bounds byRoundingCorners: UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii: (CGSize){10.0, 10.}].CGPath;
self.tableView.layer.mask = maskLayer;
or just using:
self.tableView.layer.cornerRadius = 10.0
for the whole table
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow