1

I know it's possible to convert an iPad app to a universal app, my question is is it worth it.

All the app does, is it shows an initial screen with a list of servers that it detects using UDP broadcasts. Once a user clicks on one, it loads a page from that server into a UIWebViewControl. That's it. It's pretty simple. I've looked at converting an exiting iPad app to a universal app and don't really like the process. My main hang up is understanding interface builder without the convenience of storyboard, especially the way the original coder had set it up. I'm also not sure how to make the app load a different view for the iPhone / iPod than it does for the iPad.

That being said, should I convert the app or just re-write it?

nick
  • 2,833
  • 3
  • 34
  • 61

2 Answers2

2

Your Universal convert should be effortless. Your iPad users would appreciate the work. But definitely convert it unless you are planning on adding some major UI changes in which a rewrite would be beneficial.

In an easy way to determine iPad code from iPhone code, use:

#define IDIOM    UI_USER_INTERFACE_IDIOM()
#define IPAD     UIUserInterfaceIdiomPad
#define IPHONE   UIUserInterfaceIdiomPhone

In regards to the above IDIOM, I have seen Apple use the following in iOS 5.1:

[[UIDevice currentDevice] userInterfaceIdiom]

So you can also use

#define IDIOM    [[UIDevice currentDevice] userInterfaceIdiom]

Example

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if ( IDIOM == IPAD ) {
        /*  Device is an iPad, so let the interface rotate.  */
        return YES;
    }else{
        /*  Device is an iPhone / iPod touch, so do not allow the interface rotate.  */
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    return YES;
}
WrightsCS
  • 50,551
  • 22
  • 134
  • 186
  • The problem I'm having is not necessarily differentiating between the code. I'm ok with that, the issue I'm having is adding in views to the app for the iPhone and having it load them. I tried creating a new View with the name of "SelectServerViewController~iphone.xib" where the main view for the iPad is called "SelectServerViewController.xib". When I run the app on the iPad simulator everything works as expected. When I run it on the iPhone simulator I get a solid black screen, even though I set the color of the view to be green. Unless I'm missing something this should work. – nick Mar 20 '12 at 22:06
  • Would the iPad users notice a difference? If I rewrite it, then I would do so as a universal app and then release it as an update to the iPad app so they wouldn't have to buy it again. Unless I'm missing something they shouldn't notice a difference other than it will run on their iPhone too right? – nick Mar 20 '12 at 22:23
  • If you "convert" the app to Universal, then you just change the code making sure frames and such are modified for the iPad layout. iPhone users won't see a difference. You would just upload that converted app as the update so current users won't have to buy it — even those who have an iPad as well. – WrightsCS Mar 20 '12 at 22:49
  • It's already an iPad app, I'm wanting to be able to deploy it on the iPhone as well. I've changed the build target to use iPhone / iPad and told the info.plist to use my new xib as the "Main nib file base name (iPhone)" so I was expecting a green screen, not a black one unless I'm still missing something. – nick Mar 20 '12 at 22:58
  • Same steps for iPad -> iPhone conversion. You need to make sure you are loading a view (probably from a XIB in your situation) for the iPhone version. – WrightsCS Mar 20 '12 at 23:26
1

If the app is that small then start from scratch. You may copy most of the old code over if you think it is worth doing so.

Hermann Klecker
  • 14,039
  • 5
  • 48
  • 71