Skip to content

Instantly share code, notes, and snippets.

@software-mariodiana
Last active April 30, 2021 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save software-mariodiana/fc71b9a73c3c120c01a160847467c639 to your computer and use it in GitHub Desktop.
Save software-mariodiana/fc71b9a73c3c120c01a160847467c639 to your computer and use it in GitHub Desktop.
#import "MDXEllipseView.h"
@interface MDXEllipseView ()
@property (nonatomic, strong) UIColor* mdx_backgroundColor;
@end
IB_DESIGNABLE
@implementation MDXEllipseView
- (void)setBackgroundColor:(UIColor *)backgroundColor
{
self.mdx_backgroundColor = backgroundColor;
[super setBackgroundColor:[UIColor clearColor]];
}
- (void)drawRect:(CGRect)rect
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextAddEllipseInRect(ctx, rect);
CGContextSetFillColorWithColor(ctx, [[self mdx_backgroundColor] CGColor]);
CGContextFillPath(ctx);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment