I've got an image with 1x , 2x and 3x types with resolutions 404*750 , 808*1500 and 1212*2250 respectively.
Here is my code:
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bgr"]];
On my iPhone the background is not repeated and its good. but the iPad background is repeated 4 times.
Would you know why is this happening?
From Apple's reference
You can use pattern colors to set the fill or stroke color just as you would a solid color. During drawing, the image in the pattern color is tiled as necessary to cover the given area.
So in iphone device image is large enough to cover the area ... but in ipad it's not large enough to cover the area ... so it will repeat itself.
You can use image.xcassets for different image for iphone and iPad ...
see the screen shot
You can use different image for iPad with proper size to overcome this error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With