I am looking for a way to find the value(text) of a UILabel at a given (x,y) coordinate.
All other questions seem to be about getting the (x,y) of a label, I am try
You can accomplish this by hit-testing.
Pass the point you want to the top-level view, and it will return the deepest view within the view hierarchy that contains that point.
UIView *view = [self.view hitTest:location withEvent:nil];
In Swift, it would look like
let selectedView = view.hitTest(location, withEvent: nil)
Update:
You need to set the label's userInteractionEnabled
to true for your labels to register the hit.
You'll need to check the returned view to see if it is a label, then check to see if it has any text.
if let label = selectedView as? UILabel
{
if label.text!
{
// .. do what you want with the label's text
}
}