-2

の上部の角だけを丸める必要がありUIViewます。次のコードを使用しようとしています。

UIBezierPath *maskEmailPath = [UIBezierPath bezierPathWithRoundedRect:self.emailandAccessView.bounds byRoundingCorners:UIRectCornerBottomLeft cornerRadii:CGSizeMake(10.0, 10.0)];
CAShapeLayer *maskEmailLayer = [CAShapeLayer layer];
maskEmailLayer.frame = self.myview.bounds;
maskEmailLayer.path = maskEmailPath.CGPath;
self.myview.layer.mask = maskEmailLayer;

しかし、それはそのビューのすべてを隠します。誰でも私を助けてください。

4

1 に答える 1

1

これがあなたのやり方です。

  CALayer *capa = self.view.layer;
  CGRect bounds = capa.bounds;
  UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:bounds
                                                 byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)
                                                       cornerRadii:CGSizeMake(5.0, 5.0)];

  CAShapeLayer *maskLayer = [CAShapeLayer layer];
  maskLayer.frame = bounds;
  maskLayer.path = maskPath.CGPath;

  [capa addSublayer:maskLayer];
  capa.mask = maskLayer;
于 2012-12-28T11:23:57.883 に答える