objective c - Draw CAShapeLayer LAYER without the fillColor -


Hello, I draw a line and find out that when it touches the "touch touches" it works fine, but The yellow part is taken as a part of the line Enter image details here

I have to remove the yellow part of the image ... it is a component called the fillcolor of the component, I entrust this property to zero, but still be taken as a part of the line

This is the code that I'm working on:

  self.path = [UIBezierPath bezierPath]; [Self-pawth movablepoint: CGPwontec (10, 150)]; [Self-Pot AdvertiToint: CGPointMake (110, 150) Controlpoint 1: CGPointMake (40, 100) Control Point 2: CG PointMake (80, 100)]; [Self-Pot Adwords Two Point: CGPointMake (210, 150) Controlpoint 1: CGPointMake (140, 200) controlPoint2: CGPointMake (170, 200)]; [Self. Path adrave to point: CG point make (310, 150) control point 1: CG point make (250, 100) control point 2: CG point make (280, 100)]; //[self.path addCurveToPoint: CGPointMake (310, 150) Controlpoint 1: CGPointMake (250, 100) Control Point2: CGPointMake (280, 100)]; Self. Layer = [Caspelier Layer]; Self.layer.lineWidth = 10; self.layer.strokeColor = [UIColor redColor] .CGColor; Self.layer.fillColor = [UIColor yellowColor] .CGColor; Self.layer.path = self.path.CGPath; Self.layer.shadowOffset = CGSizeZero; Self.layer.lineCap = kCALineCapRound; Self.layer.fillRule = @ "non-zero"; [Self.view.layer addSublayer: self.layer];   

This property:

  self.layer.fillColor = [UIColor yellowColor] .CGColor;   

Touch event:

  - (zero) Detected Draw: (NSSET *) touches the event: (UEIVENT *) for event {(UITT * Touch touches) {CGPoint touchpoint = [see in touch location: self. View]; If ([Shelf Path is included in: TCLock]] {NSLog (@ ":% @", @ "Touch"); }}}   

I had already tried to set zero to zero, color and nothing is shown, only red line, that is correct but touched return It gets right where the yellow part will be ... Is it possible to remove or start this section without the figure? Thanks in advance

The way you are driving the path, the way it hits There is nothing to do with -tested When you check that there is a point in the path, then it will check that the point is inside the field, even if you do not fill a color while painting the path.

Instead you have to generate a new path to do what you want, where the field is the stroke path. You can do this in core graphics (CGPath instead of UIBezierPath):

  // A shape layer you should get the presence from there CGPith REF tap target path = CGPithCreative CPBstroting path (Your Ubizar Path. CPAPT, NOUL, // path FMXF ( 35.0, SPEAK LINELINE LINELINE), / if Path is thin, you probably want a thicker stroke (such as ShapeLayer.lineCap, yourShapeLayer.lineJoin, yourShapeLayer.miterLimit) to 35 points) hit testing;   

You can read more about all of this

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -