Search code examples
iosobjective-cuiviewuilabeluitouch

iOS: How to Detect subview position around view


I have a Label named "Lable_Match" (in self.view)
and a UIView(in self.view).
In that View there are 1000+ labels.
and view is move using touch move method. and When user move View and he touch end that time check view subview lable is on the "Lable_Match" if any one lable is on this so the check text are same or not.


Solution

  • I believe you want to use this method: [self.view convertRect:self.label.frame fromView:self.view.subview];

    from this post: How to get the frame of a view inside another view?

    This will give you the adjusted position of the label form your list of 1000+ labels. You can then compare that to the label of Label_match , then compare their text