투케이2K

127. (Objective-C/objc) [간단 소스] AppDelegate 에서 앱 로드 시 스토리보드 (story board) 지정 방법 본문

Objective-C

127. (Objective-C/objc) [간단 소스] AppDelegate 에서 앱 로드 시 스토리보드 (story board) 지정 방법

투케이2K 2022. 10. 28. 14:15

[개발 환경 설정]

개발 툴 : XCODE

개발 언어 : OBJECTIVE-C

 

[소스 코드]

 

@implementation AppDelegate

UIStoryboard *storyBard_;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    
    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    {
        NSLog(@"화면 사이즈 : %d",iPhoneVersion);
        if(  iPhoneVersion == 6 )
        {
            storyBard_ = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhnoeSE(2nd)" bundle:nil];//  iPhnoe SE (2nd)
        }
        else if(iPhoneVersion == 62)
        {
            storyBard_ = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhnoe_11_Pro_Max" bundle:nil];//  iPhnoe 11 Pro Max
        }else if(iPhoneVersion == 4 ||iPhoneVersion == 5 )
        {
            storyBard_ = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhnoeSE(1st)" bundle:nil]; //  iPhnoe SE (1st)
        }
        else if(iPhoneVersion == 61)
        {
            storyBard_ = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhnoe_8_Plus" bundle:nil];//  iPhnoe 8 Plus
        }
        else
        {
            storyBard_ = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhnoe_11_Pro" bundle:nil];//  iPhnoe 11 Pro
        }
        UIViewController *initViewController = [storyBard_ instantiateInitialViewController];
        [self.window setRootViewController:initViewController];
        [self.window makeKeyAndVisible];
         
        
    }
    

    return YES;
}

 


 

반응형
Comments