0

I need to update an app which was written for the iPhone 4 screen size to work on the iPhone 5. I have read on SO about AutoLayout and so on, but the problem is that each screen in this app is made up of a background image, which then has touchable areas and such drawn on in code. These are positioned absolutely. This isn't the way I would have designed the app, but it's the task I am faced with.

I have two problems to solve:

1) How do I load the correct background image. Do I need to create a separate image size for each and them in code query the device size each time an image is loaded? To give some context, there are well over 100 images.

2) How do I maintain the touchable areas. Is it best to just add the required number of pixels to the bottom of the app? Would this then work, or will I need to query device size and change coords accordingly every time I draw something?

Thank you,

Sam

samiles
  • 3,768
  • 12
  • 44
  • 71
  • Widely asked question.. Please read through StackOverflow. http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices – lakshmen Apr 08 '13 at 14:24
  • I know it is, and had searched extensively but couldn't find my specific question. That is, how to do it when the entire app is images. Naturally, the normal answers of AutoLayout didn't seem to work for me. Sorry if you still feel it's a duplicate. – samiles Apr 08 '13 at 14:27

1 Answers1

4

Autolayout will work in the device is running iOS 6 or higer.

1) Yes you will need a image larger image for all the images in your app. You could overload some methods in a base class to make this more easy to load the correct image. An other option is to stretch the image, but this is up to you.

2) I would adjust my coordinates to the size of the device.

If Apple would add an other screen size you will run in the same problem again. You should try and create an interface that can grow with the screen.

rckoenes
  • 69,092
  • 8
  • 134
  • 166
  • Thanks. I'm basically fixing someone else's code. I agree this isn't a good way to do it (I would have created a single background image and drawn icons and such on each time) but I've a tight deadline so gonna have to do it the quick way for now. – samiles Apr 08 '13 at 14:26