This may be a dumb question


#1

If I begin an application as an iPad application… is there a way for me to later on switch it to be an iPhone application?

I know you can change that in the Project target, in the devices section

but what I mean is in the view controller, since the window stays as an iPad window, and if you delete it and add a new window it keeps on adding the iPad size not the iPhone one…

Any suggestions? Do you have to start everything from scratch once you notice you’ve made this mistake?

Thanks!!


#2

Later on, you will see how applications can be changed to support iPad/iPhone/Universal. The short answer is no, you don’t have to start over. Typically, with an application that is on both devices, you have a separate XIB file for each device. So you could add another XIB file (you’ll have to configure it correctly, which you will get into in Chapter 7) with the iPhone interface.

There are ways of naming a XIB file so that you don’t have to write any code to handle the difference in devices:

WhereamiViewController~ipad.xib
WhereamiViewController~iphone.xib

By doing this, the WhereamiViewController will load the appropriate XIB file.