Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 7    Views: 85

JimmySaver
Aspiring developer
Profile
Posts: 187
Reg: Apr 09, 2012
location unknow...
5,870
07/17/13 05:27 AM (12 years ago)

Selecting a different Home Menu Screen based on device (iPhone or iPad etc.)

Hi there, I've seen similar threads but nothing as specific. I'd like to build a single app for both phone and tablet but, I'm struggling to optimise the one menu screen for both. I think the most elegant solution would be to have two "Home Menu" screens (one for iPhone, one for iPad) which would be launched according to what device was being used (the following screens could then also be different based on this menu). I've seen solutions for displaying different HTML depending on the device using the resolution factor in the code itself but nothing for this particular problem. Any ideas / solutions / work arounds gratefully received. (As an aside, it's for a client who wants a paid-for app and we agree that charging users twice for same product is not very fair! However, could I missing something in that it's possible to do submit two binaries for the same product?)
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/17/13 05:57 AM (12 years ago)
It kind of depends on your 'style'. With respect to the plugins and code: Naturally, 'old school' typically draws everything out programmatically. If this is the case you would use things like 'screen.width' and 'screen.height' as part of the math to size and place your controls and stuff. "newer" school folks like me tend to use 'xib' (pronounced 'nib') files for our plugins. In this case, I tend to create 3 xib files; one for iPhone 3/4, one for the iPhone 5, and one for the iPad. In my code I use an 'if' statement to test for the screen size, which points to the correct xib file to display. That's what 'I' do. Different plugins are created by different vendors, and attention might need to be taken to ensure each plugin is correct for the devices you're targeting. If you're just talking HTML files, then I use CSS that (similar to the code) targets particular screen sizes, and displays images, text, and other elements dynamically with respect to the device. There is absolutely no need to release two binaries. My apps are compatible on both the iPhone 3,4,5 and iPad 1,2,3. Granted, not 'everything' takes advantage of the differences in display, but in some cases things are quite a bit different. What in particular were you looking for? Code or HTML? Cheers! -- Smug
 
JimmySaver
Aspiring developer
Profile
Posts: 187
Reg: Apr 09, 2012
location unknow...
5,870
like
07/17/13 06:30 AM (12 years ago)
Hi Smug, Thanks for the response, informative as always! I'd be new school on this - so looking for code. If I were to go for using the xib menu plugin, it would be possible to code it with an "if" to detect the device? I'll admit - I'd then have to learn how to do this!
 
ThomasB
Lost but trying
Profile
Posts: 162
Reg: Jun 23, 2011
Palo Alto
3,270
like
07/17/13 11:08 AM (12 years ago)
Nice response Smug. I've wanted this for a while. Specifically, the iPad looks best when it has a split screen design (menu down left 1/3 of page, and content in right hand 1/3rd. I've been hoping that some intrepid soul will release a plugin to accomplish this. But it might not be possible with the BT core architecture, I don't know.
 
mutzy
Aspiring developer
Profile
Posts: 841
Reg: Nov 03, 2010
Medford, MA
9,860
like
07/17/13 11:37 AM (12 years ago)
Jimmy, I created the xib button menu plugin so can give you some insight in that. It comes with two xibs... one for iPhone and one for iPad. The Phone only has one view that is optimized for iPhone 5 so you have to keep the older smaller screens in mind while designing it. The ipad xib has two views, one for portrait and another one for landscape, allowing better control. You do not need to use any "if, then" statements to load the correct xib, it happens on its own. At this point the xibs are literally blank slates with buttons that you can customize, move around,etc. It is NOT possible to have a split screen type menu unless you do some extra coding on your own. hope that helps. josh
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
07/17/13 02:19 PM (12 years ago)
Could you post a screen shot of the look that you are trying to achieve? It might be easier to suggest solution.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/17/13 03:02 PM (12 years ago)
Mutzy is right; If you're using his plugin, there is no 'if (size....) then (do that...)' - The device will automatically load the right xib file for it. In some of my cases, I'll still use an 'if' statement, because I've created different xib files for iPhone 3/4 and iPhone 5. The big difference is really just more 'height' on the iPhone 5. If you're just using controls, you might not have to go this route. But I use custom backgrounds that won't look right on the 'other' device, so I create discrete xibs. Check out this apple document: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/LoadingResources/Introduction/Introduction.html#//apple_ref/doc/uid/10000051i-CH1-SW2 And read the section titled "iOS Supports Device-Specific Resources" Let us know your additional questions! Cheers! -- Smug
 
JimmySaver
Aspiring developer
Profile
Posts: 187
Reg: Apr 09, 2012
location unknow...
5,870
like
07/18/13 12:03 AM (12 years ago)
Josh, awesome, thanks! (I suppose it would have helped if I'd used your plugin in the first instance, I'm a little ashamed I didn't). Will get on this next week. Smug, this is a great idea and gives a complete "belt and braces" approach to the menu screen. I'll start with the plugin, then get to learning my "ifs"!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.