사용자 프레임워크 생성 후 프레임워크 안에 있는 Storyboard를 호출하여 사용해야 할 때가 있다.

그럴땐  NSBundle을 사용하여 Storyboard를 호출할 수 있다.


 Object-C 

NSBundle* frameworkBundle = [NSBundle bundleWithIdentifier:@"com.test.myProject"];

UIViewController* vc = [[UIStoryboard storyboardWithName:@"MyStoryboard" bundle:frameworkBundle] instantiateViewControllerWithIdentifier:@"MyViewController"];


 Swift 

let frameworkBundle = NSBundle(identifier: "com.test.myProject")

let storyboard = UIStoryboard(name: "MyStoryboard", bundle: frameworkBundle)


UIViewController* vc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"storyboardViewController"];

[vc setModalTransitionStyle:UIModalTransitionStylePartialCurl];

[self presentViewController:vc animated:YES completion:nil];

'Storyboard' 카테고리의 다른 글

Framework 안에 Storyboard 호출  (0) 2015.04.10
메인 스토리보드 이름 설정 및 확인  (0) 2015.04.03


메인으로 사용되는 스토리보드의 이름은 TARGETS -> Info 에서 Main storyboard file base name 에서 설정 및 확인 할 수 있다





+ Recent posts