有没有办法比较CGPoints? [英] Is there a way to compare CGPoints?

查看:103
本文介绍了有没有办法比较CGPoints?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要这样的事情:

CGPoint a = CGPointMake(1, 1);
CGPoint b = CGPointMake(1, 1);

if ([CGHelperClass compareCGPoint:a to:b]){
  //do something
}

我知道写自己是微不足道的,但我很好奇它是否已经存在于某处。

I know it's trivial to write yourself, but I'm curious if it's already there somewhere.

推荐答案

CGPointEqualToPoint :返回两个点是否相等。

CGPointEqualToPoint: Returns whether two points are equal.

bool CGPointEqualToPoint (
   CGPoint point1,
   CGPoint point2
);

来自: https://developer.apple.com/documentation/coregraphics/cgpointequaltopoint

这篇关于有没有办法比较CGPoints?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆