uibezierpath

Place images along a bezier path

落爺英雄遲暮 提交于 2019-11-26 20:25:25
Does anyone know how to place images along a bezier path? I can write the path fine and animate a sprite along the path but I want to make the path a series of arrows instead of dotted lines. I assumed there must be a way to add arrow images all along the path but can't find it. Also the paths are all curved: UIBezierPath * path = [UIBezierPath bezierPath]; [path moveToPoint:startingPoint]; [path addCurveToPoint:endPoint controlPoint1:controlPoint1 controlPoint2:controlPoint2]; I guess you want something like this: You can find my complete demo app project in this github repository . Anyway,

Drawing class drawing straight lines instead of curved lines

这一生的挚爱 提交于 2019-11-26 18:57:09
I have the below code that draws lines using UIBezierPath. The code uses addCurveToPoint which should draw curved lines using a cubic bezier path, however the end result of the code is instead drawing connected straight lines but addLineToPoint isn't being used. What could be going on, why isn't the code drawing curved lines? import UIKit class DrawingView: UIView, UITextFieldDelegate { // Modifiable values within the code let lineWidth : CGFloat = 2.0 let lineColor = UIColor.redColor() let lineColorAlpha : CGFloat = 0.4 let shouldAllowUserChangeLineWidth = true let maximumUndoRedoChances = 10

Union UIBezierPaths rather than apend path

笑着哭i 提交于 2019-11-26 18:26:08
问题 I have an app where I take a UIBezierPath and use it as a brush by a series of appendPath: calls. After a few goes and with really complex brush shapes the memory runs out and the app grinds to a halt. What I really want to do is a full on union exactly like Paint Code does but I can't find any way of doing this. How would I go about unioning two or more UIBezierPaths? EDIT: Here is a visual of what I want to achieve dynamically. In Paint Code you take two paths and overlap them like this:

UIBezierPath doesn't work in TopRight corner and BottomRight corner

女生的网名这么多〃 提交于 2019-11-26 18:24:14
问题 I want to round my right corners, but only works for Left corners let path = UIBezierPath(roundedRect: view.bounds, byRoundingCorners: [UIRectCorner.TopLeft, UIRectCorner.TopRight], cornerRadii: CGSizeMake(20.0, 20.0)) let maskLayer = CAShapeLayer() maskLayer.path = path.CGPath view.layer.mask = maskLayer view.layer.masksToBounds = true 回答1: The problem is that you're getting the view's bounds before it's been resized for the current device. It's larger than it will be later when it appears

UIBezierPath intersect

三世轮回 提交于 2019-11-26 17:14:23
问题 I've been searching for an answer for hours but have trouble finding anything on the topic. I have a question related to Objective-c. I'm making an application in which a UIView checks for touches from the user and if the user touches and moves his/her finger, a path using UIBezierPath is drawn. If the user draws so that the path intersects itself it should disappear from the screen. When the user is done drawing the pattern, a line from the last point in the path should connect with the

UIBezierPath Multiple Line Colors

℡╲_俬逩灬. 提交于 2019-11-26 16:56:02
问题 My attempt to draw UIBezierPath lines with different colors is failing me. All the lines change to the currently selected color. All my path and information are all stored in an NSMutableArray called pathInfo. In path info I drop in array that contains the Path, Color, Width, and Type of line. This works fine except all the lines turn to whatever color the user has selected. I would appreciate any help greatly! - (void)drawRect:(CGRect)rect { UIBezierPath *drawPath = [UIBezierPath bezierPath]

How to Animate a UIBezierPath

安稳与你 提交于 2019-11-26 12:55:19
问题 i would like to animate a UIBezierPath of a rect to a triangle one, not to animate a view on a path but animate the path itself so it morphs from one shape to another. the path is added to a CALayer CAShapeLayer *maskLayer = [CAShapeLayer layer]; maskLayer.fillColor = [[UIColor whiteColor] CGColor]; maskLayer.path = [self getRectPath]; -(CGPathRef)getTrianglePath { UIBezierPath* triangle = [UIBezierPath bezierPath]; [triangle moveToPoint:CGPointZero]; [triangle addLineToPoint:CGPointMake

Draw Graph curves with UIBezierPath

南楼画角 提交于 2019-11-26 12:03:33
问题 I\'m drawing a graph in my application. My problem is that I want to draw line joining vertex points as curves. Currently I\'m drawing them with UIBezierPath \'s function addLineToPoint: . I want to draw them as curves. I\'m well aware that UIBezierPath has following two functions to support this feature. Cubic curve: addCurveToPoint:controlPoint1:controlPoint2: Quadratic curve: addQuadCurveToPoint:controlPoint: But problem is that I don\'t have control points. All i have is two end points.

UIBezierPath Triangle with rounded edges

亡梦爱人 提交于 2019-11-26 11:50:19
问题 I have designed this code to generate a Bezier Path that is used as a path for a CAShapeLayer to mask a UIView (the view\'s height and width are variable) This code generates a triangle with sharp edges, but I would like to make it round cornered! I have spent a good 2 hours trying to work with addArcWithCenter... , lineCapStyle and lineJoinStyle etc but nothing seems to work for me. UIBezierPath *bezierPath = [UIBezierPath bezierPath]; CGPoint center = CGPointMake(rect.size.width / 2, 0);

How to draw a “speech bubble” on an iPhone?

微笑、不失礼 提交于 2019-11-26 10:09:49
问题 I\'m trying to get a \"speech bubble\" effect similar to the one in Mac OS X when you right click on something in the dock. Here\'s what I have now: I need to get the \"triangle\" part of the lower portion. Is there any way I can draw something like that and get a border around it? This will be for an iPhone app. Thanks in advance! EDIT: Many thanks to Brad Larson, here\'s what it looks like now: 回答1: I've actually drawn this exact shape before (rounded rectangle with a pointing triangle at