iOS 7 BUG - NSAttributedString does not appear

后端 未结 7 830
南旧
南旧 2020-12-03 07:04

Last week I asked a question about a Simulator bug with NSAttributedString not displaying: iOS 7 Simulator Bug - NSAttributedString does not appear

Unfortunately it

7条回答
  •  余生分开走
    2020-12-03 07:34

    I had the same issue in my application. It was occurring in the simulators, as well as on my device (iPhone 5 running 7.0.2 (11A501)). I then realized that my UILabels living in other ViewControllers were displaying NSAttributedStrings using the NSUnderlineStyleSingle attribute properly.

    After some troubleshooting. It seems that if you're using the default font (I'm using System 17.0) and your UILabel has a height of less than 62 pixels, it will display correctly regardless of what background color, text color, or alignment you are using. A change of the UILabel's height to a value greater than 61 pixels, allowing auto-sizing to change the height for you, or a change of the font to a Custom one will result in the disappearing of the underlined NSAttributedText.

    At first I thought this issue might be due to my positioning the UILabel behind the new Status Bar (or lack thereof), but even in positions which would interact with this new feature, the height-rule still held. I find it hard to believe that the height of the UILabel would cause such an issue, but that's the conclusion I came to.

提交回复
热议问题