How to find whether two objects intersect each other?

后端 未结 2 1523
不知归路
不知归路 2021-01-04 21:22

I used the following code to create and animate the object

//For creating two imageview 
UIImageView *bbl1Obj=[[UIImageView alloc]initWithFrame:CGRectMake(34         


        
2条回答
  •  自闭症患者
    2021-01-04 21:50

    Use CGRectContainsPoint which gives the objects intersect.

        if(CGRectContainsPoint([bbl1Obj bounds], CGPointMake(bbl2Obj.frame.origin.x, bbl2Obj.frame.origin.y)))
        {
    NSLog(@"intersect");
        }
    

提交回复
热议问题