i want to make an if statement, so if some images are on a specific coordinate, there will be a sound

StackOverflow https://stackoverflow.com/questions/15394808

문제

i know how to make playin a sound but i don't know how to use the 'CGPointisEqualtoPoint' method. How do i use that or are there other ways?

-(void)beloning {
if (//CGPointisEqualtoPoint?!
    )  {
    //play sound
}
도움이 되었습니까?

해결책

From the docs:

Returns whether two points are equal.

bool CGPointEqualToPoint (
     CGPoint point1,
    CGPoint point2
);

But you may be better off with this one:

CGRectContainsPoint
Returns whether a rectangle contains a specified point.

bool CGRectContainsPoint (
     CGRect rect,
     CGPoint point
);

So now you can check if the rect of your image contains the coordinate point you care about

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top