tags:

views:

24

answers:

1

Hello.

I'm developing an iPhone application.

I have a UIView used to augmented reality. I add some UILabel to that UIView dynamically and I want to know if there is a way to know when a UILabel hide another UILabel added on same UIView.

In other words: I'm adding UILabels at the middle of the screen (y position is always the same, x can vary). When I'm going to add another UILabel, I want to know if there is another UILabel at the same position.

Note: A UILabel will have a (x,y) origin position and a height and a width.

Maybe there is a method to know where are "located" subview from a UIView.

Thanks.

+1  A: 

If you do not apply any transforms to your views you can use CGRectIntersectsRect functions to views' frames:

if (CGRectIntersectsRect(label1.frame, label2.frame){
 // Intersect
}
Vladimir
I have the following line: `[[viewToDraw layer] setTransform:transform];`. I'm afraid I can't do that.
VansFannel