Delegate method not being called objective C
<p>I am trying yo pass data of two textfields in secondViewController to  ViewController and set text of labels in ViewController.</p>

<p>But the delegate method for passing data is not being called. I have checked it by putting break point. Hence label text is not changing.</p>

<p>SecondViewController.h</p>

<pre><code>#import &lt;UIKit/UIKit.h&gt;

@class SecondViewController;
@protocol SecondViewDelegate &lt;NSObject&gt;

-(void)getText1:(NSString*)str1 andText2:(NSString*)str2;

@end
@interface SecondViewController : UIViewController&lt;UITextFieldDelegate&gt;


@property (weak, nonatomic) IBOutlet UITextField *textField1;
@property (weak, nonatomic) IBOutlet UITextField *textField2;
@property (weak) id&lt;SecondViewDelegate&gt;delegate;

@end
</code></pre>

<p>SecondViewController.m</p>

<pre><code>#import "SecondViewController.h"

@interface SecondViewController ()




@end

@implementation SecondViewController

@synthesize delegate=_delegate;

- (void)viewDidLoad {
    [super viewDidLoad];
    self.textField1.delegate=self;
    self.textField2.delegate=self;
    [self.textField1 becomeFirstResponder];

    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


-(BOOL)textFieldShouldReturn:(UITextField *)textField
{


    if ( textField == self.textField1 ) { [self.textField1 resignFirstResponder]; [self.textField2 becomeFirstResponder]; }
    else if ( textField == self.textField2)  {


        [_delegate getText1:self.textField1.text andText2:self.textField2.text];

        NSLog(@"%@",self.textField1.text);
        [self.navigationController popToRootViewControllerAnimated:YES];
    }
    return YES;
}
@end
</code></pre>

<p>View Controller.h</p>

<pre><code>#import &lt;UIKit/UIKit.h&gt;
#import "SecondViewController.h"

@interface ViewController : UIViewController&lt;SecondViewDelegate&gt;


-(void)getText1:(NSString *)str1 andText2:(NSString *)str2;
@end
</code></pre>

<p>View Controller.m</p>

<pre><code>#import "ViewController.h"


@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *label1;
@property (weak, nonatomic) IBOutlet UILabel *label2;


@end

@implementation ViewController
@synthesize label1;
@synthesize label2;

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)onClick:(id)sender {
    SecondViewController* sv= [[SecondViewController alloc] init];
    sv.delegate=self;

    [self performSegueWithIdentifier:@"moveToSecondController" sender:self];
}

-(void)getText1:(NSString *)str1 andText2:(NSString *)str2{

    [label1 setText:str1];
    [label2 setText:str2];


}

@end
</code></pre>