对于标签,我设置了attributedText:
let greenColor = UIColor.green
let thePrivacyPolicyAttribute = [.underlineStyle: NSUnderlineStyle.single.rawValue, .foregroundColor : greenColor] as [NSAttributedString.Key : Any]
let thePrivacyPolicyAtrStr = NSAttributedString(string: "\(NSLocalizedString("thePrivacyPolicy", comment: ""))", attributes: thePrivacyPolicyAttribute)
let iAgreewithAtrStr = NSAttributedString(string: NSLocalizedString("Iagreewith", comment: ""))
let resultAtrStr = NSMutableAttributedString()
resultAtrStr.append(iAgreewithAtrStr)
resultAtrStr.append(thePrivacyPolicyAtrStr)
privacyPolicyTextLabel.attributedText = resultAtrStr
在所有设备上的结果看起来都很完美,但是在iPhone SE上看起来:
我发现问题是在执行privacyPolicyTextLabel.attributedText = resultAtrStr
在其他设备(iPhone 6、6 Plus,X)上看起来很完美:
为什么iPhone SE会发生问题以及如何解决?
更新1:
已附加Content Hugging Priority
和内容Compression Resistance Priority