2016-06-15 11 views
-1

私は青いUIViewを持っていて、私はトップコーナーが必要です。
は、これは私のコードです:UIViewコーナーの問題

UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.backgroundContentView.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight) cornerRadii:CGSizeMake(20.0, 20.0)]; 
CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init]; 
shapeLayer.frame = self.backgroundContentView.bounds; 
shapeLayer.path = path.CGPath; 
self.backgroundContentView.layer.mask = shapeLayer; 

しかし、私は唯一のleftTopコーナーを持っています。どうして?それは助けにはならなかった

enter image description here

+0

へのallocメモリにこのコード。結果は同じです – user3788086

+0

またhttp://stackoverflow.com/q/35685726/77567 –

答えて

0

使用CALayer

CAShapeLayer *maskLayer = [CAShapeLayer layer];

関連する問題