Blurry UILabel when added programmatically Blurry UILabel when added programmatically ios ios

Blurry UILabel when added programmatically


Your label is blurry because the frame is using floating numbers.

To force integers value for your frame just do :

[loadingText setFrame:CGRectIntegral(loadingText.frame)];

You could also cast all your values composing your frame to int, but CGRectIntegral does all the job for you.


Apart from the float/int issue, calling setShouldRasterize on the parent view of the UILabel can also cause this problem to appear.


For those of you that couldn't use the previous answers, I found that if I turned off the autoresizingmask feature it called the setShouldRasterize method.

[loadingText setTranslatesAutoresizingMaskIntoConstraints:NO];

thus if you comment this line out, it will display correctly