zacwest / ZSWTappableLabel

UILabel subclass for links which are tappable, long-pressable, 3D Touchable, and VoiceOverable.
MIT License
169 stars 37 forks source link

Label doesn't inherit textAlignment #2

Closed zacwest closed 9 years ago

zacwest commented 9 years ago

If the label has a text alignment set, it doesn't inherit (like it does for font) the text alignment, so the tapping rects may be off if it's not left-aligned.

zacwest commented 9 years ago

This does not occur if you set an NSParagraphStyleAttributeName in the attributedText like so:

NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
style.alignment = NSTextAlignmentCenter;
options.baseAttributes = @{ NSParagraphStyleAttributeName: style };

However, the label should handle the -[UILabel textAlignment] being changed from left.