I\'ve UILabel which has some text and 2 month names like \"In the month of January and July, sun shine will be peak\" I sub classed UILabel and added touch event to it. Now
- (void)tapped:(UITapGestureRecognizer *)tap
{
CGPoint location = [tap locationInView:_label];
NSDictionary *attribute = @{NSFontAttributeName: _label.font};
CGFloat width = 0;
for (int i = 0; i substringWithRange:NSMakeRange(i, 1)];
CGSize lettersize = [letterStr sizeWithAttributes:attribute];
width += lettersize.width;
if (width >= location.x ) {
NSLog(@"str: %@", letterStr);
break;
}
}
}