Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add rounded corners to any view using layer mask.
#import <UIKit/UIKit.h>
@interface UIView (RoundedCorners)
- (void)setRoundedCorners:(UIRectCorner)corners radius:(CGSize)size;
@end
#import "UIView+RoundedCorners.h"
#import <QuartzCore/QuartzCore.h>
@implementation UIView (RoundedCorners)
- (void)setRoundedCorners:(UIRectCorner)corners radius:(CGSize)size {
UIBezierPath* maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corners cornerRadii:size];
CAShapeLayer* maskLayer = [CAShapeLayer new];
maskLayer.frame = self.bounds;
maskLayer.path = maskPath.CGPath;
self.layer.mask = maskLayer;
}
@end
@BananZGan

This comment has been minimized.

Show comment
Hide comment
@BananZGan

BananZGan May 14, 2018

Hi, after setting this for my UITableViewCell, the swipe to delete button is missing in IOS10.
The button is still clickable but it is not visible.
image
It works perfectly fine in iOS11, did you face this problem before?

Hi, after setting this for my UITableViewCell, the swipe to delete button is missing in IOS10.
The button is still clickable but it is not visible.
image
It works perfectly fine in iOS11, did you face this problem before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment