zoukankan      html  css  js  c++  java
  • 判断一个点是否在view上

    - (void)inArea
    {
        CGMutablePathRef pathRef = CGPathCreateMutable();
        CGPathMoveToPoint(pathRef, NULL, 4, 4);
        CGPathAddLineToPoint(pathRef, NULL, 4, 14);
        CGPathAddLineToPoint(pathRef, NULL, 14, 14);
        CGPathAddLineToPoint(pathRef, NULL, 14, 4);
        CGPathAddLineToPoint(pathRef, NULL, 4, 4);
        CGPathCloseSubpath(pathRef);
        CGPoint point=CGPointMake(5, 5);
        CGPoint outPoint=CGPointMake(1, 1);
        if (CGPathContainsPoint(pathRef, NULL, point, NO)) { NSLog(@"point in path!");
        }
        if (!CGPathContainsPoint(pathRef, NULL, outPoint, NO)) { NSLog(@"outPoint out path!");
        }
    }
  • 相关阅读:
    kindeditor的使用
    阅读笔记(三)
    阅读笔记(二)
    架构漫谈
    阅读笔记(一)
    hdfs
    暑假周总结八
    暑假周总结七
    暑假周总结六
    暑假周总结五
  • 原文地址:https://www.cnblogs.com/bing-ge/p/4615934.html
Copyright © 2011-2022 走看看