1
votes

I am working on the project I described in IPhone development: How to build a custom view hierarchy? . I am still struggling with the issues I described in that topic and meanwhile I tried to do something meaningful.

I needed to print a background image in the first view and I wrote the following code in my _MyAppName_ViewController.m class:

self.backGroundImage = [UIImage imageNamed:@"giris.jpg"];
self.view.backgroundColor = [UIColor colorWithPatternImage:self.backGroundImage];

backGroundImage is a property I declared in the header file, in the type of UIImage. giris.jpg is an image with the size of 640x960 but what I see in the simulator is that the upper left 320x480 sized part of the image. I tried to change the IOS Simulator Device type from IPhone to IPhone (Retina 3.5 Inch) and to IPhone (Retina 4.0 Inch) but I get the same results. Is there something I am missing in the code?

1
It's because you confused "points" with "pixels". Your giris.jpg should be 320x480, and you should have also a [email protected] in your App Bundle. Then UIKit will select the right one for you.Boris Prohaska

1 Answers

2
votes

Please make sure that you included proper Non retina and retina image size of 320x480 and 640x960 respectively. The problem is the giris.jpg is of size 640x960 is considering as non retina due to its name.

For Non retina - 320x480 - giris.jpg For Retina - 640x960 - [email protected]