IOS developed to draw single of multiple fillet instance code for view

  • 2021-10-13 08:52:34
  • OfStack

IOS developed the code for drawing single (multiple) fillet instances for the view

Foreword:

Draw rounded corners for the view. You can select upper left corner, lower left corner, lower right corner, upper right corner and all rounded corners


//Core Raduias

UIView *actionView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:actionView.bounds byRoundingCorners:UIRectCornerTopRight | UIRectCornerBottomRight cornerRadii:CGSizeMake(20, 20)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = actionView.bounds;
maskLayer.path = maskPath.CGPath;
actionView.layer.mask = maskLayer;

The UIRectCorner enumeration values are as follows:


typedef NS_OPTIONS(NSUInteger, UIRectCorner) {

  UIRectCornerTopLeft   = 1 << 0,
  UIRectCornerTopRight  = 1 << 1,
  UIRectCornerBottomLeft = 1 << 2,
  UIRectCornerBottomRight = 1 << 3,
  UIRectCornerAllCorners = ~0UL
};

Thank you for reading, hope to help everyone, thank you for your support to this site!


Related articles: