我正在通过 UIBezierPath 在 uiview 上制作弧线。弧线做得很好,但是当我拍摄此 UIView 的快照以共享弧线时,快照中没有显示。uiview 显示为默认值,圆弧和圆角矩形不显示。这是快照 CGSize sz = CGSizeMake(bottomview.frame.size.width, bottomview.frame.size.height); 的代码
UIGraphicsBeginImageContext(sz);
[bottomview.layer renderInContext:UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
resultImageView.image=image;
这是制作 arc UIBezierPath *aPathbottom = [UIBezierPath bezierPath]; 的代码
[aPathbottom moveToPoint:CGPointMake(0, 262)];
[aPathbottom addLineToPoint:CGPointMake(0, 15)];
[aPathbottom addLineToPoint:CGPointMake(10, 10)];
[aPathbottom addLineToPoint:CGPointMake(20, 6)];
[aPathbottom addLineToPoint:CGPointMake(40, 3.5)];
[aPathbottom addLineToPoint:CGPointMake(60, 6)];
[aPathbottom addLineToPoint:CGPointMake(70, 10)];
[aPathbottom addLineToPoint:CGPointMake(80,15)];
[aPathbottom addLineToPoint:CGPointMake(80, 250)];
[aPathbottom addLineToPoint:CGPointMake(70, 256)];
[aPathbottom addLineToPoint:CGPointMake(60, 260.5)];
[aPathbottom addLineToPoint:CGPointMake(50, 264)];
[aPathbottom addLineToPoint:CGPointMake(55, 264.5)];
[aPathbottom addLineToPoint:CGPointMake(40, 265)];
[aPathbottom addLineToPoint:CGPointMake(45, 264.5)];
[aPathbottom addLineToPoint:CGPointMake(40, 264)];
[aPathbottom addLineToPoint:CGPointMake(20, 260.5)];
[aPathbottom addLineToPoint:CGPointMake(10, 256)];
[aPathbottom addLineToPoint:CGPointMake(0, 250)];
[aPathbottom closePath];
CAShapeLayer *maskLayerbottom = [CAShapeLayer layer];
maskLayerbottom.frame = bottomview.bounds;
maskLayerbottom.path = aPathbottom.CGPath;
bottomview.layer.mask = maskLayerbottom;
我不知道为什么会这样。任何人都可以帮助我。
问候 chakshu 阿罗拉