Skip to content

Instantly share code, notes, and snippets.

@warriorg
Created August 20, 2015 02:27
Show Gist options
  • Save warriorg/5bdaa77c28f2b3cec0f5 to your computer and use it in GitHub Desktop.
Save warriorg/5bdaa77c28f2b3cec0f5 to your computer and use it in GitHub Desktop.
底部加圆角
UIBezierPath * bezierPath = [UIBezierPath bezierPathWithRoundedRect:topicView.bounds
byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
cornerRadii:CGSizeMake(5, 5)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = topicView.bounds;
maskLayer.path = bezierPath.CGPath;
topicView.layer.mask = maskLayer;
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, ScreenWidth - 10, 44)
byRoundingCorners:(UIRectCornerBottomLeft|UIRectCornerBottomRight)
cornerRadii:CGSizeMake(10.0, 10.0)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = CGRectMake(0, 0, ScreenWidth - 10, 44);
maskLayer.path = maskPath.CGPath;
bottomView.layer.mask = maskLayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment