As most of us know 2x images are directly supported by iOs SDK for retina display, but it doesn’t support in case of layer. However, we have got this issue in one of the project where we are drawing image on a layer and images are showing blur.
The main reason behind this is that layer directly doesn’t support 2x (retina display). In this case we need to set content scale property of a layer explicitly.
.e. layer.contentsScale = 2.0;
Here, we need to check running device support to retina display or not.
if ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] &&
([UIScreen mainScreen].scale == 2.0))// check device support retina display if yes then set scale value 2.0 i.e. 2x
self.contentsScale = 2.0;