Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective C: Comparing CGPoints

I am trying to do an if-else statement for my CGPoints how would I be able to do that, I tried this code...

if (point1 != point2)
{
       //statement
}

I'm having this error

Invalid operand for binary expression...

Thanks!

like image 773
Ramiro Avatar asked Jan 12 '12 05:01

Ramiro


Video Answer


1 Answers

Try to use function CGPointEqualToPoint instead.

if (!CGPointEqualToPoint(p1,p2))
{
  //statement
}
like image 177
xhan Avatar answered Oct 19 '22 01:10

xhan