updating iOS5 app to use auto layout and iOS8 baseline - ios

I have an iOS 5 era app that I need to update to "modern" terms to be able to submit an update to the app store. I am shooting for iOS 8 as a baseline using auto layout and size classes.
The base UI is a Tab Bar controller, each tab of which has a UINavigationController as its base.
MainWindow.xib is the main nib file used when opening the app.
I opened all the nibs and checked Use Autolayout and Use Size Classes.
The app runs, but always comes up as a 3.5" phone sized app, even on a 6 Plus (device or simulator). I cannot find any constraints applicable nor any settings in any of the nibs that seem to affect this.
The Tab Bar itself seems stuck at the 3.5" size and I can find no constraints or settings on this. The window and tab bar element themselves in the nib show the generic 600x600 / any-any size.

You need to add launch images for each device size you want to support. That tells iOS that the app actually can be displayed at that size and resolution.
Additionally you will want to add #3x assets for the iPhone 6+.

Related

IB Storyboard for App Extensions: iPad Icons Not Present, Sizes Don't Change, Orientation Not Working

I need to update a 3 year old iPhone-only, portrait only (NOT universal) camera/photo app that worked with iOS 8 that contains a Share extension that now (with 10.0???) crashes at times (but works many other times), and I'm trying to debug the issues and update to iOS 9.0.
The first issue I found and fixed was the lack of Privacy strings for access to the camera and photo library.
But I also found that the extension does not work with Photos on an iPad with layout issues (in the Simulator so far). As the docs say, extension targets must be made for iPhone/iPad and my build setting for the target extension are set to 1,2, and I use Auto Layout.
The storyboard, the Extension scene, a View Controller Scene, all view controllers, views and subviews all are set for Auto Layout as well as Safe Area Layout Guides, but the only devices shown in IB are iPhones with no iPads available, when selecting other devices no change is seen in size, and the iPhone is constrained to portrait mode.
I've tried setting the main app as Universal, allowing every orientation, building, and still no iPad icons in IB to test the UI for the extension (and trying to get Landscape mode in IB doesn't work either).
Is there a way to get IB to show and allow iPads/iPhones, particularly iPads, and change orientation during development for app extensions?
Selecting "Use Trait Variations" made the iPad icons appear.

Device Layout Does Not match Simulator or Storyboard

I've been away from Xcode for a while, so I may have missed changes in the latest couple of releases. The layout of views looks identical in the Storyboard, and on the simulators (iPhone6 and iPhone7), but different on my iPhone 6. I have no warnings or errors in the Storyboard, and I am using Xcode 8. The device acts as if it had a shorter screen than the simulator -- things that are spread appropriately on the storyboard or simulator, are squeezed together vertically on my phone. What is the reason for this difference?
Have you assigned launch images with the correct dimensions for the different form factors? An easy way to verify this is to add a print statement in a view controller to see what the bounds are for the screen. Verify that these values match what you expect for the device.
The following from Apple documents this:
Because device screen sizes vary, launch screen sizes vary too. To
accommodate this, you can provide a launch screen as an Xcode
storyboard or as a set of static images for the devices your app
supports. Using an Xcode storyboard is the recommended approach, as
storyboards are flexible and adaptable.
While not an official Apple site, this link also references this as a potential issue:
The launch XIB or storyboard is required to support iPhone 6 sized
apps.
Another possibility is that you have the screen zoomed in on the device. To change this, go to Settings > Display & Brightness and select Display Zoom at the bottom. Ensure that you have Standard selected. If you are zoomed in, then the device will scale down (A 6 behaves like an SE, a Plus behaves like a 6/7).

Same Storyboard for different screen Sizes without Auto Layout

I've been using different storyboard for different screen sizes.
Now, I'm updating an old app with only one Storyboard for iPhones and it looks the same appearance as iPhone 5 in different iPhone simulators, without using auto layout. Works well on iPhone6 and 6 plus Simulator.
Can I trust this behaviour or is any simulator bug? Is it due to any Properties project config ?
You must use auto-layout otherwise it will not work 100%. If you enable auto resize subviews option in storyboard view then it might work upto some extent.
I got it... Just not setting any launch screen image for the devices without defined storyboard

Views in storyboard do not resize properly on iPhone 6

I've checked a lot of different websites and stackoverflow answers, and I'm still stuck.
I developed an app for iPhone and iPad targeting iOS 7.1. I have two storyboards, one for each device. The app only displays in portrait mode. I cannot seem to get the app to display full screen on the iPhone 6 simulator.
I've tried numerous things, I followed the advice linked here by adding a Launch Screen, setting the iPhone storyboard to auto layout and "use size classes", and . Not only does that not affect the size, but the Launch Screen doesn't seem to scale properly either. If I get it to fit the iPhone 6 it doesn't fit the iPhone 5 properly.
I've tried adding the proper launch images and I don't get any errors saying the wrong image resolution is present.
I've used the storyboard as a Launch Screen described here.
Now, when I switched to "use size classes" I could manually extend the objects in the views to match up with the size of iPhone 6 (I have not tested it for 6s) but that makes it extend past the iPhone 5 boundaries. The only thing I can think of right now is to create another storyboard and detect if it's iPhone 6, but I would really like some other ideas.
Here's what it looks like for iPhone 6:
And here's what it looks like on iPhone 5:
Best advice i can give u is
Use default size class , the classic 600x600 and then use Auto Layout
Or do the reverse, take a 3.5inch size VC and apply Auto Layout on it. Everything will present itself quite perfectly if you can apply the right constraints
Here is a link for an awesome Autolayout tutorial

How/whether to make a universal storyboard in Xcode

When creating a storyboard file in Xcode, you must select if it is for iPhone or iPad. This implies one should always put iPhone and iPad UIs into separate storyboards. Is this true?
My app has multiple storyboards. While the Main.storyboard files largely differ between iPhone and iPad, other storyboards are nearly identical. The only difference might be segue being a push on iPhone vs popover on iPad, which can be handled programmatically. It seems awfully silly and redundant to make two storyboards.
So if making one "universal" storyboard, should iPhone or iPad be selected in Xcode? Does it matter?
As of Xcode 6, we can create a single unified storyboard for all the devices.
For more info - Documentation
iOS 8 makes dealing with screen size and orientation much more
versatile. It is easier than ever to create a single interface for
your app that works well on both iPad and iPhone, adjusting to
orientation changes and different screen sizes as needed. Design apps
with a common interface and then customize them for different size
classes. Adapt your user interface to the strengths of each form
factor. You no longer need to create a specific iPad storyboard;
instead target the appropriate size classes and tune your interface
for the best experience.
There are two types of size classes in iOS 8: regular and compact. A
regular size class denotes either a large amount of screen space, such
as on an iPad, or a commonly adopted paradigm that provides the
illusion of a large amount of screen space, such as scrolling on an
iPhone. Every device is defined by a size class, both vertically and
horizontally. iPad size classes shows the native size classes for the
iPad. With the amount of screen space available, the iPad has a
regular size class in the vertical and horizontal directions in both
portrait and landscape orientations.
Edit:
It only supports iOS 8(backward compatible applies only for iOS 7) and later.
You've got to create to separate storyboards for each kind of device. If you would delete the iPad storyboard, than your app would use the iPhone's one. You'll realize it when you'll see the 2x button at the bottom of the screen. Everything will be scaled to fit the larger screen - and the graphics would be really bad.
The only suitable workaround is to copy-paste everything from your iPhone Storyboard to iPad storyboard. Just follow the next steps:
Open iPhone.storyboard,
Press CMD+A,
Press CMD+C,
Switch to iPad.storyboard,
Press CMD+V,
You'll see, that all the screens, segues, properties and actions are transferred to your new storyboard. All that you have to do is to fix the frames of all your elements so that they'll suit new screen sizes.
And don't forget, that a good iPad application shouldn't be the same as the iPhone version. There are a lot of cool things which you can do with iPad!

Resources