0

So far I've only dealed with iPhone Apps and the time has come to make them universal. I was watching the lecture about universal Apps by Paul Hegarty on iTunesU and some questions poped into my head.

If I understood the concep allright the main difference between an iPad and an iPhone (when coding) is that the iPad allows the splitview controller and one should take advantadge of it, right?

What Mr. Hegarty did was to adapt the code on one App and add conditionals to differ when the App was running on an iPad or an iPhone.

My question is, is that the usual way it is done? I am a very organized guy and I like stuff to be as much structured as possible. So my first though was to create a complete set of view controllers to manage the iPad storyboard rather that have a single view controller filled with code for both devices. is it possible to do so as well? what is considered to be a good practice?

Thanks in advance!

Marcal
  • 1,371
  • 5
  • 19
  • 37

2 Answers2

1

I think a good practice for a universal app would be reuse as much code as possible. Otherwise, why not create two different apps?

There are not that many differences between iphone and ipad controls except on iPad we can use popover and split view. So I would share the code in view controller as much as I can.

Raymond Wang
  • 1,484
  • 2
  • 18
  • 33
  • Well, if you create two Apps, the users will have to buy it twice. Once for the iPhone and one for the iPad. I´m doing a test project to test this and so far I´m working on a common code and it doesn´t seem as complicated as I anticipated. – Marcal Jun 13 '12 at 05:50
  • No it shouldn't be if you have clean code written in MVC way. Your model should be completely separate from your View so it doesn't matter. In your controller, if you are using the same controls in both your iphone view and ipad view, then you can share the code. You have to write code when you don't use the same controls. – Raymond Wang Jun 13 '12 at 18:44
  • Yeah, I'm very meticulous when it comes to MVC. It helps me to keep things organized. As I said, so far it's been much easier than expected. Thanks for the input! – Marcal Jun 13 '12 at 19:20
0

I just published a git for "converting" iPhone app into Universal app. Take a look - https://github.com/BTLibrary/BTSplitViewController

Byte
  • 2,920
  • 3
  • 33
  • 55
  • You have watched the WWDC videos from this year, right? – jrturton Jun 09 '14 at 15:16
  • Yep, and trait collection is highly cumbersome to say the least. One would need extended time and resources to understand, let alone work it into their existing model. Oh and want to support iOS7? sorry can't. So... before you go off and say we should all write codes in Swift and use all the latest and greatest API, I would advise you to wait and see how things play out. Did I mention, my method takes 5 minutes to implement? – Byte Jun 09 '14 at 18:15
  • I was talking about the changes to UISplitViewController that seem very similar to what you've implemented here, but never mind. Perhaps I should have added a ;) or something? – jrturton Jun 09 '14 at 19:17
  • Sorry, I was not aware of the changes to the UISplitView. Thanks for letting me know. I will go check it out. – Byte Jun 10 '14 at 15:36