Define a protocol on the first page, and define a protocol method to get the return value of the second page back to the first page.
#import <UIKit/UIKit.h>
#pragma mark defines a protocol for parameter passing
@protocol edelegate <NSObject>
-(void) Setreturnpwd: (NSString *) password;
@end
In the implementation file of the first page, implement the Protocol method, and set the proxy in the method of jumping to the second page.
#import "ViewController.h"
#import "MainViewController.h"
@interface Viewcontroller () <edelegate>
@end
@implementation Viewcontroller
#pragma mark Implementation Proxy method
-(void) Setreturnpwd: (NSString *) password{
Self._pwd.text=password;
}
-(void) login: (ID) sender{
Mainviewcontroller *mainview=[self.storyboard instantiateviewcontrollerwithidentifier:@ "Second"];//This is the second page, Page to jump from
mainview.delegate=self; Set up Proxy
[Self Presentviewcontroller:mainview animated:yes completion:nil];
}
Define the proxy in the header file on the second page
#import <UIKit/UIKit.h>
@protocol edelegate;
@interface Mainviewcontroller:uiviewcontroller
#pragma mark defines the proxy
@property (Nonatomic,strong) id<edelegate> delegate;
@end
In the implementation file of the second page, the proxy arguments are called in the method that returns the first page.
#import "MainViewController.h"
#import "ViewController.h"
@interface Mainviewcontroller ()
@end
@implementation Mainviewcontroller
-(void) BACKV: (ID) sender{
[Self.delegate Setreturnpwd:self._sname.text]; Invoking proxy arguments
[Self dismissviewcontrolleranimated:yes completion:nil];
}
ios-Page Pass Value