Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Using different Storyboards for different iPhone sizes

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 491
    Comment on it

    If we are using storyboards we can handle different sizes by creating different storyboards for iPhone 4 and iPhone 5 and handle them in didFinishLaunching method of AppDelegate in this way :

    Here for iPhone 4 we have storyboard named "Main_iPhone_4s" and for iPhone 5 we have storyboard named "Main_iPhone"

    UIViewController *initialViewController;
    
        CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;
    
        // iPhone 4
        if (iOSDeviceScreenSize.height == 480)
        {
            // Instantiate iPhone 4 storyboard
            UIStoryboard *iPhone35Storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone_4s" bundle:nil];
    
            // Instantiate the initial view controller object from the storyboard
            initialViewController = [iPhone35Storyboard instantiateInitialViewController];
        }
    
        // iPhone 5
        if (iOSDeviceScreenSize.height == 568)
        {
            // Instantiate iPhone 5 storyboard
            UIStoryboard *iPhone4Storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
    
             // Instantiate the initial view controller object from the storyboard
            initialViewController = [iPhone4Storyboard instantiateInitialViewController];
        }
    
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.window.rootViewController  = initialViewController;
        [self.window makeKeyAndVisible];
    
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: