I'm developing a universal iOS app that has some settings that make no sense for certain devices. Specifically, I'd like to hide certain settings from the user on devices where the portrait width is below a threshold. (So, for instance, some settings should not be available on an iPhone 7 but should be available on an iPhone 7 Plus.)
I'm aware that it's possible to have different settings for iPhone and iPad devices (as described in this thread), but that's not what I'm after. I'm also familiar with size-class-specific layouts, but that doesn't seem applicable to settings.
Is it possible to hide (or at least disable) certain settings based on the dimensions of the device on which the app is running?
Along the same lines, is it possible to have the default values for settings vary according to the display dimensions?
Sorry but it's impossible. You are right that all that you can is to have different settings.bundle for iPads and iPhones. Since iOS 4 Settings plists can be device-dependent: Root~ipad.plist will be used on iPad and Root~iphone.plist on iPhone. If not existed, Root.plist will be used.
So from my point of view you can achieve part of your goal using this 2 settings filed. For more specific cases you can set some default values when app launched. Settings.bundle can't be modified directly from code, so you can't remove or disable specific setting but you can change it value to some default value on specific device. Each item in Settings.bundle is paired with key in NSUserDefaults so you can just set values in NSUserDefaults and the settings application will automatically reflect this. It will be saved elsewhere, though. You can just read it back the same way as you would do with the settings bundle, also through NSUserDefaults.
You can find code example in this answer https://stackoverflow.com/a/32648047/5285151
One more interesting option is to use https://github.com/futuretap/InAppSettingsKit which add same with native settings interface in to the app. And this internal settings synched with device settings but you have more control on it.
Related
I'd like to take my existing iPhone app and modify its layout/number of screens for an iPad.
I began by duplicating the Target with "Duplicate and Transition to iPad".
But I'm unsure where to go after that. I'll need a new Storyboard and some of the functions/viewControllers/views will need to be modified. Where/how do I do that?
All I can find are very old solutions that are no longer valid or leave too much out:
How to convert iPhone app to iPad app
This is the best one I've found, but again not current and still leaves a lot out:
http://innovationm.co/convert-iphone-application-to-universal-application/
I no longer see a "Universal" option. I am guessing that selecting all of these accomplish the same thing?
First, edit your target to make sure it is set for both iPhone and iPad:
Second, using two different storyboards is unusual nowadays, but you can easily do it. In your Info.plist configure two entries (using Raw Keys and Values): UIMainStoryboardFile and UIMainStoryboardFile~ipad. The result is that your app will load one storyboard for an iPhone and a different storyboard for an iPad.
Note that with a newer created project that uses window scenes under iOS 13 and later, you would configure UIApplicationSceneManifest and UIApplicationSceneManifest~ipad to specify different UISceneStoryboardFile values.
Here's a downloadable project that demonstrates the newer structure:
https://github.com/mattneub/Programming-iOS-Book-Examples/tree/master/bk1ch09p358universal
I have a large app that I will need some time to optimize for iOS9.
Edit: What I am worried about is all the UI getting squeezed together when the app window size is reduced. So my question is, is there any way to force full screen for the app?
To opt-out (disable) multi-tasking for your application:
Select your Target → General Section → Scroll Down and
check Requires full screen
It gets applied to the plist's UIRequiresFullScreen key value.
Note: Apps are required to support all screen orientations if it supports multitasking. Otherwise, apps will get the following error on publishing:
Invalid Bundle. iPad Multitasking support requires these orientations: ...
You have to modify your project to support multitasking. According to WWDC 2015 video, to adopt your app for multitasking, satisfy these requirements:
Build your app with iOS 9 SDK
Support all orientations
Use Launch Storyboards
So, if any of this is not done yet, your app will not be able to support multitasking.
Of course, if you don't use size classes, put it at the top of the list.
Edit: according to you question edit. There is a UIRequiresFullScreen key in Info.plist. See more at Apple docs
To opt out of Slide Over and Split View, do so explicitly by adding the UIRequiresFullScreen key to your Xcode project’s Info.plist file and apply the Boolean value YES.
You can set above thing using General tab of Targets, Select Requires Full Screen check. Refer below image for the same
Note :
A user can disable Slide Over and Split View in Settings > General >
Multitasking. If you think you’ve set up everything correctly and find
that these features still don’t work, check this setting.
See Adopting Multitasking Enhancements on iPad - Slide Over and Split View Quick Start.
It's still possible to opt-out of iPad multitasking — but Apple announced at WWDC 2019 that in April 2020, all iPad apps will be required to support multitasking.
The original announcement and discussion is in the first few minutes of "Modernizing Your App for iOS 13", and there's a (brief) announcement on their developer-news site as well.
I just created a new app with a MvvmCross template. But the iOS resolution looks like non-retina. Also, I only have i386 and x86_x64 as supported architectures and not ARM like all my other projects have. So what do I need to change that the app runs on the native resolution?
Has some one an idea what I need to change that the app stops looking like it was made for a 4" iPhone instead of a new app? Here are a few screenshots that may help to make clear what I mean (the App "PLZ Suche" is the one with the 'old' looking resolution, compared in the App Switcher it is clearly visible - all screenshots are taken on a iPhone 6S).
Problem solved -
This 'compatibility-mode' is triggered when you do not include a retina resolution splash screen (or launch screen as it is called in the Apple ecosystem) in your app.
Make sure that you have all the right types of splashscreens included in your app.
You can either:
use a Storyboard (or XIB) that adapts to different screen resolutions automatically
use XCode Asset catalog 'LaunchImage' image set, and fill all the correct sizes
You can read more about all the sizes and the launch screen on the Apple documentation page.
I have completed an iPad app which only available on iPad iTune store.
But client wants to have different design but similar functionality application for iPhone as well. Some of new feature must be added to iPhone version. I can use most of the functionalities in iPad version and have a new project and build iPhone from scratch!
My requirements will be change during time. New requirements could be for both or either of them. Therefore, I need to add new features in both applications time to time and maintain both applications as well. This app is pretty much complex with more than 150 classes. I need some advice to know is it better to have only one application to works on both devices or it is better practice to have separate project for each iPhone and iPad?
EDIT
I want to use split view controller and vertical menu bar in iPad and side menu and horizontal menu bar in iPhone.
if you want to have two separate iPhone/iPad apps on the store, just make two targets of your application. This will mean you'll probably will use two different storyboards, but that's up to you. Go to your project settings and make two separate targets - one for iPad, one for iPhone. Edit the target general settings where one should only deploy for iPad while the other for iPhone. Posted some pictures below:
You'll want to also go to Manage Schemes, remove the current schemes you have and add the targets you just made. Then set these macros in your iPhone build so you can just edit one code base without needing to edit both the phone and tablet code -
Some example Code:
// Just for Phone Target
#ifdef PHONE
- (void)somePhoneMethod;
#endif
// For both phone and tablet device
- (void)aMethod;
I'd like to add to what everyone has said and if there isn't too much difference just make a universal app.
Use Auto layout and maintain in a single storyboard.
If you know about classes ,Autolayout Strong then my preference is
AutoLayout.
It will reduce your time and easiest handling.
this is Classes here if you like to do vertical layout only for ipad means ,you need to select like this
like this you can choose only for ipad,iphones,portrait,landscape like this :),Its upto your decision.
If UI is same for both so its better to use existing just check in classes for iPad and iPhone.
My app has unique interface for each iPhone model. More specifically, there is a unique interface for each screen size. While I could embed everything in a single app, there are many unused assets. For instance, full screen image for iPhone 4S requires 1.76 MB, but IPA requires 12.63 MB for the same asset because it contains a separate image for each possible screen size.
Is it possible to submit separate IPA's for each iPhone model, where each includes only assets required for that specific iPhone?
No you can't. The workflow Apple has built is to include all assets for every screen size. You use tools like autolayout to show and hide things based on screen size.
please change your project to support auto-loayout or handle view programmatically.
what you intended wont work.
You don't need to (or are able to), have multiple .ipa files for an app at one time. In fact, you've probably created more work for yourself then you actually needed to do by trying to do so.
Apple is now encouraging developers to embrace Adaptive User Interfaces. As their guide states, "With the latest advancements with View Controllers in iOS 8 and Auto Layout in Xcode, it’s now even easier for you to adapt your user interface to context and different sized devices". In other words, you only need a single storyboard for all iOS devices.
I would encourage you to do some more research on this concept, and adopt it for your app. This tutorial should get you started.