Developing a Universal App

In the past I have written my apps for ipad and then used xcode to test it out on the iphone simulator. However I’d like to develop for both and test it within codea before moving to xcode. I’m looking for others ideas on this.

I’m thinking that I can use deviceMetrics().platformName to get the current device running the application. I figure I can set up a table with all other iDevice specs and use that for testing. Basicly just overwrite WIDTH/HEIGHT to whatever device I want to test for.

What have you guys done or think about testing for iphone in codea?

I just wrote a super simple function called iPhone() that takes a parameter (4 or 5) and sets WIDTH and HEIGHT to the correct dimensions for the iPhone. I call it as the first thing in setup()

@JakAttack I did the same table with all ios resolutions with Portrait/landscape orientations, I’m just not sure that will cut it.

I posted my Device emulator.

My simple solution on making universal apps was to just sub in something for WIDTH and HEIGHT. For example, in ScramWords I start out the Setup() by setting width=WIDTH and height=HEIGHT and then just use the lowercase equivalents elsewhere in the code.

When I want to test what the game will look like on an iPhone, I add two lines of code right below these definitions: width=320 and height=480 (for iPhone 4) or height=578 (for iPhone 5). I comment these lines out to go back to the iPad version – and of course, leave them commented when I compile.

Fun fact: when you’re using that little chunk of screen on an iPad, the size of the displayed “iPhone” is well-nigh exactly the screen size of an actual iPhone, so you can test the size of elements and make sure that things haven’t become too small to be easily used.

Thanks @Mark, that ended up being what I did with my little Universal emulator app.