문제

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