uibezierpath

Draw/Paint like sketch color inside a bezier path in UIView

喜你入骨 提交于 2019-12-01 08:03:25
问题 I am drawing a shape layer with help of a UIBezier Path on a UIView : CAShapeLayer *pathLayer = [CAShapeLayer layer]; pathLayer.frame=CGRectMake(-view.frame.origin.x, -view.frame.origin.y, view.frame.size.width, view.frame.size.height); pathLayer.path = path.CGPath; pathLayer.strokeColor = [[UIColor blackColor] CGColor]; pathLayer.fillColor = [[UIColor clearColor] CGColor]; //pathLayer.fillColor = nil; pathLayer.lineWidth = 6.0; pathLayer.lineJoin = kCALineJoinBevel; [view.layer addSublayer

Fill Color Animation Flickers when calling block in animation did stop

回眸只為那壹抹淺笑 提交于 2019-12-01 06:37:43
问题 Im having trouble figuring out why the animation is flickering from the fromValue to the toValue after my animation block is complete. I know that after you complete an animation you have to set the values of the CALayer to the end state of the animation to keep it looking consistent. Yet no matter what order i call these methods in i keep getting the flickering result. What I'm doing is drawing a checkmark with a biezer path and then once the strokeEnd animation is complete i fill in the

How to draw UIBezierPath identical to MKPolyline in a UIView

给你一囗甜甜゛ 提交于 2019-12-01 05:47:30
问题 Currently I am tracking my location on an MKMapView. My objective is to draw a bezier path identical to an MKPolyline created from tracked locations. What I have attempted is: Store all location coordinates in a CLLocation array. Iterate over that array and store the lat/lng coordinates in a CLLocationCoordinate2D array. Then ensure the polyline is in the view of the screen to then convert all the location coordinates in CGPoints. Current attempt: @IBOutlet weak var bezierPathView: UIView!

Custom Button frame doesn't look as good as Round Rect UIButton

拜拜、爱过 提交于 2019-12-01 03:23:05
I'm trying to draw a custom button frame as follows: UIBezierPath *stroke = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:RECT_CORNECR_RADIUS]; [stroke stroke]; But for some reason the corner curves look thinker than the sides. If you look at the UIButton's default frame it's very uniform. A is a UIButton, B is a custom button. Any ideas how I can make it more like the UIButton. You are stroking the bounds of your button. This will draw your line centred over the edge the view, so half of the thickness of the line is outside the bounds and is not drawn. This is why it is

Two UIBezierPaths intersection as a UIBezierPath

本秂侑毒 提交于 2019-12-01 02:12:05
问题 I have two UIBezierPath s, one that represents the polygon of part of an image and the other is a path to be drawn on top of it. I need to find the intersection between them so that only the point that are inside this intersection area will be colored. Is there a method in UIBezierPath that can find intersection points - or a new path - between two paths ? 回答1: I wrote a UIBezierPath library that will let you cut a given closed path into sub shapes based on an intersecting path. It'll do

How to Crop the UIView with repeated semi circle?

橙三吉。 提交于 2019-12-01 02:04:06
I want to crop an UIView with bottom and top of repeated semi circle like this image I had been working on your question and here is my results, you need create a UIBezierPath and apply to your desired view, use this code for that Function to generate the desired BezierPath func pathSemiCirclesPathForView(givenView: UIView, ciclesRadius:CGFloat = 10, circlesDistance : CGFloat = 2) ->UIBezierPath { let width = givenView.frame.size.width let height = givenView.frame.size.height let semiCircleWidth = CGFloat(ciclesRadius*2) let semiCirclesPath = UIBezierPath() semiCirclesPath.move(to: CGPoint(x:0

Crazy rounded rect UIBezierPath behavior on iOS 7. What is the deal?

和自甴很熟 提交于 2019-11-30 22:14:34
The simple UIView below draws a rounded rectangle. When I pass a corner radius of 65 or below it rounds correctly, but 66 and above and it generates a perfect circle! What is going on here? It should only show a circle when the corner radius is equal to 1/2 the frame width, but it seems that it is drawing a circle when the radius is about 1/3rd, no matter what the size of the view is. This behavior appears on iOS 7. On iOS 6 I get expected behavior. #import "ViewController.h" @interface MyView : UIView @end @implementation MyView -(void)drawRect:(CGRect)rect { UIBezierPath *path =

UIBezierPath round edges?

拜拜、爱过 提交于 2019-11-30 19:07:35
Im drawing some lines and I noticed that when the edges get at a certain angle it generates a sharp edge like this: What I want it to draw: How do I do this? I have looked through the documentations but I dont seem to find anything im looking for. Or is there a way to turn that auto-edge-generating off? UIBezierPath's have a property called lineJoinStyle . Set it to kCGLineJoinRound and it will draw as you want it. UIBezierPath *myPath = ... myPath.lineJoinStyle = kCGLineJoinRound; kCGLineJoinRound property on a UIBezierPath can be called in Swift by: myPath.lineJoinStyle = .round Use

Animating a bezier curve point

落爺英雄遲暮 提交于 2019-11-30 16:57:15
I'm trying to animate a bezier curve I made with Paintcode (great app, btw) and am drawing in a custom UIView in the "drawRect" method. The drawing works fine but I want to animate a single point in the bezier curve. Here's my non-working method: -(void)animateFlame{ NSLog(@"Animating"); // Create the starting path. Your curved line. //UIBezierPath * startPath; // Create the end path. Your straight line. //UIBezierPath * endPath = [self generateFlame]; //[endPath moveToPoint: CGPointMake(167.47, 214)]; int displacementX = (((int)arc4random()%50))-25; int displacementY = (((int)arc4random()%30)

How to draw Signature on UIView

…衆ロ難τιáo~ 提交于 2019-11-30 16:39:29
I am new in ios.And I need to create a textview or label in which i can sign. Like this image. You can draw signature on UIView for that first subclass UIView and your subclass of UIView should be something like, SignatureView.h #import <UIKit/UIKit.h> @interface SignatureView : UIView{ UIBezierPath *_path; } - (void)erase; @end SignatureView.m #import "SignatureView.h" @implementation SignatureView - (void)drawRect:(CGRect)rect { _path.lineCapStyle = kCGLineCapRound; [_path stroke]; } - (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame: frame]; if (self) { [self