autoshrink

Detect tap for UILabel with Autoshrink to minimum font size enabled

折月煮酒 提交于 2021-01-29 00:29:42
问题 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

Detect tap for UILabel with Autoshrink to minimum font size enabled

隐身守侯 提交于 2021-01-29 00:28:12
问题 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

Setting the same font size for different labels AFTER scaling

╄→гoц情女王★ 提交于 2019-12-05 23:32:26
问题 I am making an app where I have 3 labels. I am using label auto-shrinking to help adapt the label's font size to the device. These labels are right next to each other, and that therefore means that I want them to have them the same font size. What currently happens is (because they have different amounts of text) they end up shrinking to different font sizes. Is there a way to make it so that after scaling, the label with the smallest font size is the standard font for all of the other labels

Setting the same font size for different labels AFTER scaling

China☆狼群 提交于 2019-12-04 07:18:02
I am making an app where I have 3 labels. I am using label auto-shrinking to help adapt the label's font size to the device. These labels are right next to each other, and that therefore means that I want them to have them the same font size. What currently happens is (because they have different amounts of text) they end up shrinking to different font sizes. Is there a way to make it so that after scaling, the label with the smallest font size is the standard font for all of the other labels. Thanks. Programatically change UIlabel font size after dynamic resizing. See the example below.