Search code examples
iphoneiosios5

How Does iPhone's Email app recognize an Address?


I have been Playing around with my iPhone and i recently realized that the Email App of iPhone can recognize if a line within an Email represents an address. Interestingly enough this works with many address Patterns. I tried USA , Germany, France and Spain. In all the cases the address was highlighted as a blue link just as a phone number would be. So my question is what is the algorithm behind this address detection?


Solution

  • Check UIDataDetectorTypes in the documentation. You'll find a UIDataDetectorTypeAddress that detects strings formatted as addresses. You could then add this detector type to a UITextView.