2014-05-22 5 views
0

삽입 광고와 같은보기를 생성하는 세 번째 파트 개발자를위한 프레임 워크를 만들고 있습니다. 이것은 응용 프로그램 RootViewController 클래스에서 myViewController (Framework 내부) 객체를 만드는 방법입니다.프레임 워크에서 UIViewController를 호출하여 메소드 호출

myViewController *ViewController =[[myViewController alloc]initWithNibName:@"myViewController" bundle:nil]; 

현재 내가

[ViewController showScreen]; 

이처럼 내 방법 (showScreen)를 호출하는 타사 개발자

[self.view addSubview:ViewController.view]; 

대신 내가 원하는 수행하여 테스트 응용 프로그램에 내 시야를로드 할 수 있어요 viewDidLoad 또는 myViewController 클래스의 init로 이동하여 뷰를 생성해야합니다.

이 내 rootviewcontroller 기능의 모습입니다

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    myViewController *ViewController =[[myViewController alloc]initWithNibName:@"myViewController" bundle:nil]; 
    [self.view addSubview:ViewController.view]; //Dont Want to use this 
// [ViewController showScreen];   //Want to use something like this 

}

@implementation myViewController 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
} 

답변

0

난 당신이 framework를 사용하는 경우 차이가 없다 믿는 myViewController에 부착 내 XIB 파일을 엽니 다 , static library ...

당신은 루트의 ViewController

- (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion NS_AVAILABLE_IOS(5_0); 

f.e

[self presentViewController:yourViewController animated:animated completion:completionHandler]; 

에서 직접 UIViewController을 제시 할 수 있습니다 또는 당신은

[yourViewController showFromViewController:self]; 
그것에서 제시 UIViewController 자신에 루트의 ViewController를 전달할 수 있습니다