uibezierpath

How to bring UIBezierPath to the back of a MKAnnotation object?

雨燕双飞 提交于 2019-12-18 12:37:43
问题 In my app, user draws a shape on map and using UIBeizerPath i am drawing that path. Then based on the coordinates of the path i am displaying the results which are only in that area. Everything works great except that now when Annotations drops on the Map view the pins looks like they are behind the path which means path looks in the front. I am using this code to display the Annotation and path : -(void)clearAnnotationAndPath:(id)sender { [_mapView removeAnnotations:_mapView.annotations];

Animating Bezier curve as though drawing proceeds on iPhone screen

感情迁移 提交于 2019-12-18 11:39:45
问题 I want to draw a bezier path of the outline of Taj Mahal's tomb. Q1. How could I draw it in XCode? I could easily do that in PS but am finding it difficult to do in XCode programmatically especially getting the coordinates of the control points. Q2. Moreover, how can the coordinates of the points be fixed when the screen sizes vary? Q3. How could I animate it as though an invisible pencil is drawing that on screen? 回答1: How do I draw a bezier path in UIKit ? Create a UIBezierPath object and

An easy way to draw a circle using CAShapeLayer

大憨熊 提交于 2019-12-18 11:01:35
问题 In questions like How to draw a smooth circle..., ...Draw Circle... and ...draw filled Circles the question and answer is very broad, contains lots of unnecessary steps and the methods used isn't always the easiest to re-create or manage. What is an easy way to draw a circle and add it to my UIView ? 回答1: An easy way to draw a circle is to create a CAShapeLayer and add a UIBezierPath . objective-c CAShapeLayer *circleLayer = [CAShapeLayer layer]; [circleLayer setPath:[[UIBezierPath

An easy way to draw a circle using CAShapeLayer

限于喜欢 提交于 2019-12-18 11:01:16
问题 In questions like How to draw a smooth circle..., ...Draw Circle... and ...draw filled Circles the question and answer is very broad, contains lots of unnecessary steps and the methods used isn't always the easiest to re-create or manage. What is an easy way to draw a circle and add it to my UIView ? 回答1: An easy way to draw a circle is to create a CAShapeLayer and add a UIBezierPath . objective-c CAShapeLayer *circleLayer = [CAShapeLayer layer]; [circleLayer setPath:[[UIBezierPath

Draw a line with UIBezierPath

筅森魡賤 提交于 2019-12-17 17:54:25
问题 First time using BezierPaths, wondering how this function is actually supposed to be implemented. Currently the bezier path moves within the frame of the image, as opposed to drawing on screen. Is there a better way to do it? func drawLineFromPoint(start : CGPoint, toPoint end:CGPoint, ofColor lineColor: UIColor, inView view:UIView) { var maxWidth = abs(start.x - end.x) var maxHeight = abs(start.y - end.y) var contextSize : CGSize! if maxWidth == 0 { contextSize = CGSize(width: 1, height:

Hit detection when drawing lines in iOS

最后都变了- 提交于 2019-12-17 16:27:32
问题 I would like to allow the user to draw curves in such a way that no line can cross another line or even itself. Drawing the curves is no problem, and I even found that I can create a path that is closed and still pretty line-like by tracing the nodes of the line forwards and back and then closing the path. Unfortunately, iOS only provides a test for whether a point is contained in a closed path (containsPoint: and CGPathContainsPoint). Unfortunately, a user can pretty easily move their finger

Polygon with rounded corners using UIBezierPath

青春壹個敷衍的年華 提交于 2019-12-14 04:16:59
问题 I would like to use UIBezierPath to create a polygon shape with rounded corners. I believe this will be possible using addCurveToPoint:controlPoint1:controlPoint2: and similar code to that found in http://www.codeproject.com/Articles/31859/Draw-a-Smooth-Curve-through-a-Set-of-2D-Points-wit, but I was wondering if there's any existing (or better) way to achieve this? I should point out that this will need to be for any convex polygon (such as found in a voronoi diagram) and not just a

Retrieve tapped UIButton in a running animation which can be slightly off the screen

我的梦境 提交于 2019-12-14 03:51:50
问题 This is what the code (below) can look like: import UIKit class TornadoButton: UIButton { override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { let pres = self.layer.presentation()! let suppt = self.convert(point, to: self.superview!) let prespt = self.superview!.layer.convert(suppt, to: pres) return super.hitTest(prespt, with: event) } } class TestViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let

Is it possible to get all uibezerpath from uiview?

 ̄綄美尐妖づ 提交于 2019-12-13 19:36:29
问题 I've been researching and found no answer. Is it possible to get all UIBezierPath from UIView once drawn in UIView if I use CGGontext for drawing it to the view? (if yes, can you give me an idea to how?) The UIBezierPath came from user input, so if the user draws a lot of UIBezierPath, I need all those path and save it to a .svg file. 回答1: Here's a better working example, after testing some of the answers I've given in my commments, this is the one that will return an array of shapelayers, or

How to plot circular buttons around a central point in a ring? [duplicate]

人盡茶涼 提交于 2019-12-13 11:14:57
问题 This question already has an answer here : How to align UIButtons within a circle? (1 answer) Closed 11 months ago . I am attempting to plot circular buttons in a ring like this. I have 6 UI buttons which all have a corner-radius of 360 degrees, what I am attempting to do in Swift is plot them equally around a central button/point just like the image above. Each circle is equally spaced from its neighbour. What is the best way of achieving this functionality? Should I create a bezier curve