Check IF your Segue.destinationViewController is a navigationController !!!
*Problem*
If your segue.destinationViewController is navigationController, the below delegate is NULL as in this code
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showAdd"]) {
[[segue destinationViewController] setDelegate:self];
}
}
*Solution*
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showAdd"]) {
// if the destinationViewController is navigationController
myViewController * myVC = (myViewController *)[segue.destinationViewController topViewController];
myVC.delegate = self;
}
}
댓글
댓글 쓰기