开发者

Comparing an objects center to a point?

开发者 https://www.devze.com 2023-01-28 11:40 出处:网络
I\'ve tried this. if (crackerButton.center == CGPoint(190,135)) 开发者_如何学编程{ //Do something

I've tried this.

if (crackerButton.center == CGPoint(190,135)) 开发者_如何学编程{
//Do something 
}

Didn't work.

Any ideas?

Cheers Newbie


Use :

if(CGPointEqualToPoint(crackerButton.center, CGPointMake(190,135)))
{
    //Do something 
}


I take it you're making a Christmas app then?

if (crackerButton.center == CGPointMake(190, 135)) {
//Do something 
}


Use the CGPointMake function to create a CGPoint.

if (crackerButton.center == CGPointMake(190, 135)) {
  ...
0

精彩评论

暂无评论...
验证码 换一张
取 消