Created
July 10, 2013 15:23
-
-
Save bobmoff/5967220 to your computer and use it in GitHub Desktop.
Add rounded corners to any view using layer mask.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface UIView (RoundedCorners) | |
- (void)setRoundedCorners:(UIRectCorner)corners radius:(CGSize)size; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It works perfectly fine in iOS11, did you face this problem before?