我正在通過UIBezierPath製作uiview上的圓弧。它正在做精細的圓弧,但是當我將此UIView的快照用於共享圓弧時,不會顯示在快照中。 uiview顯示爲默認值,弧形和圓形rectcorner不顯示。這裏是快照代碼 CGSize sz = CGSizeMake(bottomview.frame.size.width,bottomview.frame.size.height);來自UIview的快照不顯示圓弧和圓角
UIGraphicsBeginImageContext(sz);
[bottomview.layer renderInContext:UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
resultImageView.image=image;
這裏是代碼用於使電弧 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阿羅拉
不是它不工作..... – chakshu 2013-04-12 04:07:03