Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIBezierPath:如何使用-(BOOL)containsPoint:(CGPoint)pointonPath:(UIBezierPath*)路径填充法:(BOOL)填充方法填充图像?_Ios_Cocoa Touch_Cocos2d Iphone_Touch_Uibezierpath - Fatal编程技术网

Ios UIBezierPath:如何使用-(BOOL)containsPoint:(CGPoint)pointonPath:(UIBezierPath*)路径填充法:(BOOL)填充方法填充图像?

Ios UIBezierPath:如何使用-(BOOL)containsPoint:(CGPoint)pointonPath:(UIBezierPath*)路径填充法:(BOOL)填充方法填充图像?,ios,cocoa-touch,cocos2d-iphone,touch,uibezierpath,Ios,Cocoa Touch,Cocos2d Iphone,Touch,Uibezierpath,我有一个image.PNG(例如,只有黑色轮廓的动物图像),我想通过触摸iPad屏幕来填充渐变 我从这里开始遵循苹果的指南 以下是苹果的指南: - (BOOL)containsPoint:(CGPoint)point onPath:(UIBezierPath *)path inFillArea: (BOOL)inFill { NSLog(@"contains point Path %@", path); NSLog(@"Touch point %f %f", point.x, po

我有一个image.PNG(例如,只有黑色轮廓的动物图像),我想通过触摸iPad屏幕来填充渐变

我从这里开始遵循苹果的指南

以下是苹果的指南:

- (BOOL)containsPoint:(CGPoint)point onPath:(UIBezierPath *)path inFillArea:  
   (BOOL)inFill {

NSLog(@"contains point Path %@", path);
NSLog(@"Touch point %f %f", point.x, point.y );

CGContextRef context = UIGraphicsGetCurrentContext();
CGPathRef cgPath = path.CGPath;
BOOL    isHit = NO;
// Determine the drawing mode to use. Default to detecting hits on the stroked     
  portion of the path.
CGPathDrawingMode mode = kCGPathStroke;

if (inFill) { // Look for hits in the fill area of the path instead.
    if (path.usesEvenOddFillRule)
        mode = kCGPathEOFill;
    else
        mode = kCGPathFill;
}

 // Save the graphics state so that the path can be removed later.

CGContextSaveGState(context);

 CGContextAddPath(context, cgPath);

// Do the hit detection.
isHit = CGContextPathContainsPoint(context, point, mode);

CGContextRestoreGState(context);

return isHit; }
我只是想知道如何在我的应用程序中使用此方法

请告诉我具体步骤是什么


我是这方面的新手,请帮助我……

我可以问这类问题吗?