سؤال

I am using the following code to set a background in my iphone app.

[[self view] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"background_final.png"]]];

The problem is that if I try the app in iPhone 5.. retina 4" the background image gets tiled instead of having black spaces where there should not be any images.

I have a Default-568h@2x.png in the app, and it has the correct dimensions but still I am not getting the right image background.

Any Ideas on how to fix this?

هل كانت مفيدة؟

المحلول

delete the Default-568h@2x.png and you will get the expected results

نصائح أخرى

1) Default-568h@2x.png is only for the launch image. It is not used anywhere in the app.

2) colorWithPatternImage will repeat if the image size is lesser than the view

So, you can use the image with the height that will fit to the 4" screen. This will work for 3.5" screen also.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top