uibezierpath

Unexpected LineJoinStyle behavior when lines in path at 180 degrees

醉酒当歌 提交于 2019-12-21 14:11:15
问题 I'm getting a clipped LineJoin in a UIBezierPath when one line comes back exactly over the previous line. If I adjust the second line by one pixel, the LineJoin behaves as expected. Here's the code: UIBezierPath *path = [UIBezierPath bezierPath]; [path setLineWidth:10.0f]; [path setLineCapStyle:kCGLineCapRound]; [path setLineJoinStyle:kCGLineJoinRound]; [path moveToPoint:CGPointMake(100, 100)]; [path addLineToPoint:CGPointMake(200, 100)]; [path addLineToPoint:CGPointMake(150, 100)]; [path

Unexpected LineJoinStyle behavior when lines in path at 180 degrees

旧城冷巷雨未停 提交于 2019-12-21 14:10:11
问题 I'm getting a clipped LineJoin in a UIBezierPath when one line comes back exactly over the previous line. If I adjust the second line by one pixel, the LineJoin behaves as expected. Here's the code: UIBezierPath *path = [UIBezierPath bezierPath]; [path setLineWidth:10.0f]; [path setLineCapStyle:kCGLineCapRound]; [path setLineJoinStyle:kCGLineJoinRound]; [path moveToPoint:CGPointMake(100, 100)]; [path addLineToPoint:CGPointMake(200, 100)]; [path addLineToPoint:CGPointMake(150, 100)]; [path

Apply rounded corners to arc created with UIBezierPath

こ雲淡風輕ζ 提交于 2019-12-21 09:35:15
问题 I am working on a circular progress bar that i've created using UIBezierPath. The progress bar looks like the following picture: My question is: how to make the edge of the arc rounded and not rectangular? The code i used to draw the arc looks like is: // Draw the arc with bezier path int radius = 100; arc = [CAShapeLayer layer]; arc.path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(100, 50) radius:radius startAngle:M_PI endAngle:M_PI/150 clockwise:YES].CGPath; arc.position =

How to give cornerRadius for UIBezierPath

白昼怎懂夜的黑 提交于 2019-12-21 04:45:07
问题 I created a rectangle using following code and now I need to rounded the corners of this rectangle. but I can't find a property called layer.cornerRadius, can anyone help me ? class OvalLayer: CAShapeLayer { let animationDuration: CFTimeInterval = 0.3 override init() { super.init() fillColor = Colors.green.CGColor path = ovalPathSmall.CGPath } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } var ovalPathStart: UIBezierPath { let path =

iOS - Clipping union of two paths using UIBezierPath appendPath

a 夏天 提交于 2019-12-21 04:39:12
问题 I'm attempting the create a clipping path in the shape of a plus sign, so that subsequent paths that I draw into the same context have this portion removed. I create the clipping path using two rectangle paths overlaid on each other. This is what I'd like the final drawing to look like when I subsequently draw a circle: xXX| |XXx XXXX| |XXXX XXXXX| |XXXXX ——— ——— ——— ——— XXXXX| |XXXXX XXXX| |XXXX xXX| |XXx However, it actually looks like this: xXX| |XXx XXXX| |XXXX XXXXX| |XXXXX ——— XX——— ———

Bezier Path with dynamic change of width

戏子无情 提交于 2019-12-21 04:37:19
问题 I want to create bezier path with dynamically changing line's width. I need spending the same amount of color on each part of line. So, longer line should be thinner. And shorter line should be bold. Or, at least, line should change it's width from beginning to the end. Any ideas how to achieve it? Thank you. 回答1: the only way to achieve this is with multiple UIBezierPath s of different thickness and colour. 来源: https://stackoverflow.com/questions/7345251/bezier-path-with-dynamic-change-of

please set CG_CONTEXT_SHOW_BACKTRACE environmental variable

白昼怎懂夜的黑 提交于 2019-12-21 04:05:18
问题 Despite looking over more than 3 post (made in 2015) about this problem, non have solved mine. When ever I run, a simple, code to draw a line using UIBezierPath the program would return me this: : CGContextSetStrokeColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. : CGContextSetFillColorWithColor: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

Need a tip with UIBezierPath. Triangle Shape like Instagram Sign Up View

非 Y 不嫁゛ 提交于 2019-12-21 02:55:14
问题 I'm trying to create a bezier path like the instagram triangle in the picture below, however I must be doing something wrong. The Bezier path does not show! - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. } -(void)viewDidLayoutSubviews{ [super viewDidLayoutSubviews]; [self drawTriangle]; } - (IBAction)closeButton:(UIButton *)sender { [self dismissViewControllerAnimated:YES completion:nil]; } - (void)drawTriangle{ UIBezierPath* trianglePath =

Stretchy UIBezierPath line?

旧时模样 提交于 2019-12-21 02:54:39
问题 I want to draw a straight line with my finger that automatically sizes based upon how far away I am from the point of origin. So if I touch the screen in the middle and slide my finger out a line appears to 'stretch' and pivot around the point of orgin as my finger moves on the screen. WHhen I lift my finger. The Destination Point should finalize and create a line. I can drag my finger across the screen and 'Draw' on the screen but that's not what I am wanting to do. I thought UIBeizerPath

How to create UIBezierPath gradient fill?

旧城冷巷雨未停 提交于 2019-12-21 02:42:26
问题 I would like to create a UIBezierPath with 10px rounded corners and with gradient fill. How can I acheive this effect? Here's an image of what I want to do: As you can see, this square has: 2px black border 10px rounded corners red to green linear gradient fill How can I do this programatically without using pattern image color ? Here's how I create the path: UIBezierPath *border = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:10.0f]; [border setLineWidth:2]; [[UIColor