UIView *view = [UIView new];
    view.frame = CGRectMake(100, 100, 300, 100);
    [self.view addSubview:view];
    view.backgroundColor = [UIColor orangeColor];
    
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(15, 15)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = view.bounds;
    maskLayer.path = maskPath.CGPath;
    view.layer.mask = maskLayer;

  效果图如下:

UIView设置部分圆角---iOS开发UI篇

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-04
  • 2022-12-23
相关资源
相似解决方案