4

I submitted my app for review and got the error

2.10 - iPhone Apps must also run on iPad without modification, at iPhone resolution, and at 2X iPhone 3GS resolution. We noticed that your app did not run at iPhone resolution when reviewed on iPad running iOS 9.1, which is a violation of the App Store Review Guidelines. We’ve attached screenshot(s) for your reference. Specifically, when we tap to login with Facebook on the iPad no action is produced and we are unable to get the app to advance.

I have copied second storyboard for ipad with the info plist and general settings etc. I also need to make different storyboards for different iphone devices as you can see from the image my design is not possible with auto constraints.

if you look at the age it is not able to go in the box in the last 3 only the first

What my question is: do I just IB to the old View controllers the same way I did on storyboard 1 and duplicate code on each VC or do I have to create all new VCs for the new storyboard including app delegate? Secondly do I have to write code in my app delegate to state which storyboard to use depending on screen size or dose xcode 7 do this in info plist? All I can seem to find is objc code I only know swift.

so question obj c xcode 5

link ipad and main storyboard

Community
  • 1
  • 1
Grace
  • 377
  • 3
  • 19

2 Answers2

9

I couldn't use one storyboard for all device sizes due to restrictions in my design so to solve my question I added this code to my app delegate :

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    var bounds: CGRect = UIScreen.mainScreen().bounds
    var screenHeight: NSNumber = bounds.size.height
    var deviceFamily: String

    var mainView: UIStoryboard!
    mainView = UIStoryboard(name: "iphone35Storyboard", bundle: nil)
    let viewcontroller : UIViewController = mainView.instantiateViewControllerWithIdentifier("iphone35") as UIViewController
    self.window!.rootViewController = viewcontroller

    if screenHeight == 480  {
        deviceFamily = "iPhoneOriginal"
        // Load Storyboard with name: iPhone4
        var mainView: UIStoryboard!
        mainView = UIStoryboard(name: "Main", bundle: nil)
        let viewcontroller : UIViewController = mainView.instantiateViewControllerWithIdentifier("iphone4") as UIViewController
        self.window!.rootViewController = viewcontroller

    } else {

        var mainView: UIStoryboard!
        mainView = UIStoryboard(name: "IpadStoryboard", bundle: nil)
        let viewcontroller : UIViewController = mainView.instantiateViewControllerWithIdentifier("ipad") as UIViewController
        self.window!.rootViewController = viewcontroller

        if screenHeight == 920 {
            deviceFamily = "Pad"
            // Load Storyboard with name: ipad
            var mainView: UIStoryboard!
            mainView = UIStoryboard(name: "IpadStoryboard", bundle: nil)
            let viewcontroller : UIViewController = mainView.instantiateViewControllerWithIdentifier("ipad") as UIViewController
            self.window!.rootViewController = viewcontroller
        }
    }
}

And then created a new storyboard, copied and pasted the main storyboard onto the second storyboard and adjusted the sizes. And it worked i did the same then for the different iphone sizes. Hope this helps someone else.

novalagung
  • 10,905
  • 4
  • 58
  • 82
Grace
  • 377
  • 3
  • 19
4

You don't need different storyboards, you just need one! All you have to do is work with size classes. You can work on a single storyboard and sets different layout constraint or even have different UI elements for each size class.

Apple documentation

Tutorial

  • Hi thanks for the tutorial I'm going to check it out now. Can you just answer me one question, even though my design is set like in the above picture do you see the way the background image has the box for age and bio in the actual background image thats uploaded so what my problem was when I add the text field for the age the number was not in the box for age it would display outside of on different screens? Im just worried that the adaptive layout is only to adapt the everything but not actually keep them in the exact place I need them to be in. If you get me? – Grace Dec 03 '15 at 17:44
  • @Grace you need to set the layout constraint for each view in your storyboard. In you case you may want center the age into the box. If you set up a constraints for the any any configuration than it will be used by any size class configuration! – aleludovici Dec 04 '15 at 20:44
  • Size classes aren't dynamic enough in some design cases. It treats the width and height of an iPhone 7 to be the same as the 4s (C:R) when the two sizes are very different. – Michael McKenna Jul 12 '17 at 00:04
  • Apple link broken –  Jul 10 '18 at 10:29