2010-01-31 4 views
-1

루트 viewcontroller가 다중 viewcontroller를 호출하는 프로젝트가 있습니다. 하위 뷰 컨트롤러의 뷰에 버튼이 있습니다. 버튼을 누르면 루트 뷰 컨트롤러에 다른 하위 뷰 컨트롤러를로드하도록 알려주기를 바랍니다.하위 뷰 컨트롤러가 루트 뷰 컨트롤러에 다른 하위 뷰 컨트롤러를로드하도록 알립니다.

//the function in this viewcontroller 

-(IBAction)submitButtonPressed:(id)sender; 
{ 
    [self.parentViewController notifyLoadAnotherViewContrller ] ; 

} 


//the function in root viewcontroller 
-(void) notifyLoadAnotherViewContrller 
{ 

    Submit *tController = [[AnotherViewController alloc] initWithNibName: @"AnotherViewController" bundle:nil]; 
    self.vanotherViewController = tController; 

    [tController release]; 


    [self.view insertSubview:tController.view atIndex:10]; 



} 

하지만이하지 않는 내가 함수에서 브레이크 포인트 설정 작동 - (무효) 그것이 내가 함수 이름, 아무 문제를 확인 작동하지 않습니다

notifyLoadAnotherViewContrller합니다.

내가 잘못하고있는 이유는 무엇입니까? 당신의 IBAction를가 제대로 연결되어 있는지 확인 :

는 의견을

안부

InterDev에서

+0

[tController release]를 사용할 수 있습니다. ~ [tController autorelease]; 무슨 일이 일어나는지 보아라. –

답변

0

그래서 몇 가지 표준 디버깅 ... 설정 submitButtonPressed에 중단 점을 환영합니다. parentViewController를 검사하여 예상 한 결과인지 확인하십시오.

메서드가 호출되지 않기 때문에 단추가 Interface Builder에 연결되어 있지 않거나 parentViewController가 nil이되어 메서드 호출을 자동으로 무시합니다.

관련 문제