diff --git a/TSLabel/TSLabel.m b/TSLabel/TSLabel.m index c0d1c54..743daf4 100644 --- a/TSLabel/TSLabel.m +++ b/TSLabel/TSLabel.m @@ -54,6 +54,10 @@ - (void) layoutManager: (NSLayoutManager *) layoutManager didCompleteLayoutForTe if ( label != nil && [label isKindOfClass: [TSLabel class]] ) { + //this happens if label clips part of the content (NSInvalidArgumentException) + if([layoutManager.textContainers indexOfObject:textContainer] == NSNotFound ) + layoutManager = textContainer.layoutManager; + CGRect containerGlyphBounds = [layoutManager boundingRectForGlyphRange: [layoutManager glyphRangeForTextContainer: textContainer] inTextContainer: textContainer]; // determine the bounds of each link and record that information with the TSLabel @@ -239,4 +243,4 @@ - (void) touchesMoved: (NSSet *) touches withEvent: (UIEvent *) event [self setAttributedText: self.attributedText]; } -@end \ No newline at end of file +@end