UILabel blurry on some views

I recently noticed that in one of my apps I’m working on, some of the UILabels I was using were blurry. This was only obvious on non-retina devices.

After a bit of research I found that it was down to using floating numbers to define the frame of the label. Basically, floating numbers use decimals and sometimes did not line up with the onscreen pixels. The solution was to force the frame to use integer numbers instead of floats.

[lmyLabel setFrame:CGRectIntegral(myLabel.frame)];

You would be able to cast all of the frame values to integers but using CGRectIntegral will do the work for you.

Leave a Reply

Your email address will not be published. Please enter your name, email and a comment.