Detect tap for UILabel with Autoshrink to minimum font size enabled
问题 I am using the following UITapGestureRecognizer that I modified so others could copy and paste to see the same output as me. extension UITapGestureRecognizer { func didTapAttributedTextInLabel(label: UILabel, inRange targetRange: NSRange) -> Bool { // Create instances of NSLayoutManager, NSTextContainer and NSTextStorage let layoutManager = NSLayoutManager() let textContainer = NSTextContainer(size: CGSize.zero) //let mutableAttribString = NSMutableAttributedString(attributedString: label