-1

I have a project in which the root viewcontroller call multi viewcontrollers. There is button on a sub viewcontroller's view, when I press the button, I hope it notify the root view controller to load another sub 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];



}

but this does not works I set the breakpoint in function -(void) notifyLoadAnotherViewContrller

it does not work I checked the function name, no problem.

What is reason I am doing wrong?

Welcome any comment

Best Regards

interdev

1
  • can u cahnge [tController release]; to [tController autorelease]; and see what happens
    – Ayaz Alavi
    Jun 3, 2010 at 12:36

1 Answer 1

0

So some standard debugging... Set a breakpoint in submitButtonPressed: to make sure your IBAction is properly connected. Examine parentViewController to make sure it's what you expect.

Since the method is not getting called, then your button is either not connected in Interface Builder or your parentViewController is nil, which will silently ignore the method call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.