Detect touch on UIBezierPath stroke, not fill?

When you're currently not drawing (as in the touchesMoved method), there is no current context, so UIGraphicsGetCurrentContext() will return NULL.

When you're currently not drawing (as in the touchesMoved method), there is no current context, so UIGraphicsGetCurrentContext() will return NULL. As all you're doing with the context is to use its current path, you could just as well use CGPathContainsPoint instead of CGContextPathContainsPoint.

That makes sense. Thanks. How would I call CGPathContainsPoint?

Calling it like: if (!CGPathContainsPoint(self createPath. CGPath, nil, c, false)) return; Results in the same thing as UIBezierPath. ContainsPoint, as it seems to pick up both the stroke and fill areas.

Calling it like: if (!CGPathContainsPoint(self createPath, nil, c, false)) return; doesn't seem to work at all. – james May 27 '11 at 1:18 Ah, you're right, it won't work this way. I didn't notice the fillMode parameter.

Apparently you need a CGContext to do hit detection on the stroke part. Perhaps you could create a small bitmap context for this, using CGBitmapContextCreate (you'll find lots of questions about this on SO). – omz May 27 '11 at 1:57.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions