Reputation: 1392
I am making arcs on uiview by UIBezierPath.It is doing fine arc is making but when I am taking snapshot of this UIView for sharing the arcs are not displaying in the snapshot. the uiview is showing as default and the arcs and rounds rectcorners are not displaying. Here is code for snapshot CGSize sz = CGSizeMake(bottomview.frame.size.width, bottomview.frame.size.height);
UIGraphicsBeginImageContext(sz);
[bottomview.layer renderInContext:UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
resultImageView.image=image;
and here is code for making 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;
i don't know why it is happening.Can any one help me.
regards chakshu arora
Upvotes: 2
Views: 141
Reputation: 1392
I got the answer I tried
[bottomview.layer addSublayer:maskLayerbottom];
on place of bottomview.layer.mask = maskLayerbottom;
and the snapshot from the UIView
is displaying arcs.
Upvotes: 2
Reputation: 126
Have you tried adding this ?
[bottomview.layer setMasksToBounds:YES];
Upvotes: 1