0

I've got a ViewController inside a navigation controller that needs to present a modal.

The ViewController has this as its header:

@interface ViewController : BaseViewController<AuthenticateDelegate>

and in the IBAction that presents the modal:

 AuthenticationController *authVC = [self.storyboard instantiateViewControllerWithIdentifier:@"AuthControllerView"];
        authVC.delegate = self;
        [self presentModalViewController:authVC animated:YES];

The AuthenticationController has this in its .h file:

@interface AuthenticationController: BaseViewController<UITextFieldDelegate>

@property (nonatomic, assign) id <AuthenticateDelegate> delegate;

@end

As you can see, I have assigned "self" (the ViewController) as the delegate to the AuthenticationController, but for some reason, the delegate is in:

- (IBAction)SubmitAuthentication:(id)sender;
{
    [self.delegate validateUser:lblUsername.text :lblPassword.text];

    [self dismissModalViewControllerAnimated:YES];
}

Any help will be appreciated.

Bigboytony
  • 123
  • 1
  • 9

1 Answers1

1

you must create delegate property as below.

@property (nonatomic, strong) id <AuthenticateDelegate> delegate;
Romit M.
  • 898
  • 11
  • 28
  • delegates usually should be saved to weak properties http://stackoverflow.com/questions/8449040/why-use-weak-pointer-for-delegation – vikingosegundo Nov 01 '12 at 12:51