What is the value of the iOS page pass? Do you really understand?

Page values are common in iOS development, but how much do you know about page values? The author of this article is for you to introduce the specific way to pass the page, there are inadequacies, welcome to correct me, I hope we can make progress together. Note: the positive and negative value is two pages a correlation between the value.

At present, I know and master the value transfer mode: attributes, values, proxy values, Block values, KVO values, notification values, single pass values, and KVC values.

Here we see them exactly how to operate and value?

Let’s assume that we now have controllers (pages), A and controllers (pages), B, A-&gt, push-&gt, and B, that is, A, the last page of the B (controller).

  1. The attribute value of
    usage: positive value
    demand: when A-push to B, there is a need to display the Label input from a TextField A in the B, then we need to use the positive value. The A controller.M file: #import “A_ViewController.h” #import “B_ViewController.h” @interface (A_ViewController) @property (nonatomic, strong) UITextField *aTextField; @end @implementation A_ViewController (void) viewDidLoad {[super viewDidLoad]; @ self.title = “A”; self.view.backgroundColor [UIColor = whiteColor]; self.aTextField = [[UITextField alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30 self.aTextField.layer.borderColor)]; grayColor].CGColor = [UIColor; self.aTextField.layer.borderWidth = 1; [self.view addSubview:self.aTextField]; UIButton *button [UIButton = buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen Ma InScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “to B” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction: forControlEvents:UIControlEventTouchUpInside]); [self.view addSubview:button];} – (void) buttonAction: (UIButton * sender) {/ * * what time can use attribute value passing A to B, the positive value B in A advance **/ B_ViewController * bViewController page initialization = [[B_ViewController alloc] init]; bViewController.string = self.aTextField.text; [self.navigationController pushViewController:bViewController animated:YES];} @end B controller. H file: #import < UIKit/UIKit.h&gt @interface; B_ViewController: UIViewController @property (nonatomic, copy) NSString *string; @end B controller.M file: #import “B_ViewController.h” @interface B_ViewController (@end) @ implementation B_ViewController – (void) viewDidLoad {[super viewDidLoad]; @ self.title = “B”; self.view.backgroundColor [UIColor = whiteColor]; self.view.backgroundColor = [UIColor whiteColor] UILabel; *bLabel = [[UILabel alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; bLabel.layer.borderColor [UIColor = grayColor].CGColor; bLabel.layer.borderWidth = 1; [self.view = addSubview:bLabel]; bLabel.text self.stri Ng;} @end
  2. The value of
    usage: reverse value:
    requirements: A-push to B, when B disappeared, there is a need to display the Label input from a TextField B in the A, then we need to use the reverse value. The A controller.M file: #import “A_ViewController.h” #import “B_ViewController.h” @interface (A_ViewController) < BToADelegate> @property (nonatomic, strong) UILabel *aLabel; @end @implementation A_ViewController (void) viewDidLoad {[super viewDidLoad]; @ self.title = “A”; self.view.backgroundColor [UIColor = whiteColor]; self.aLabel = [[UILabel alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; self.aLabel.layer.borderColor [UIColor = grayColor].CGColor; self.aLabel.layer.borderWidth = 1; [self.view addSubview:self.aLabel]; UIButton *button [UIButton = buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen mainScree N].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “push to B” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button];} – (void) buttonAction: (UIButton * sender) {B_ViewController *bViewController = [[B_ViewController alloc] init]; / / set the proxy bViewController.delegate [self.navigationController = self; pushViewController:bViewController animated:YES] what time can be used;} / * * the value passing B to A, the reverse value passing B set A in the A page initialization method **/ execution agent for B agent – (void) transferString: (NSString * string) {self.aLabel.text = string;} @end B controller.H file: #import < UIKit/UIKit.h> / / @protocol BToADelegate &lt NSObject&gt proxy statement;; / / proxy method – (void) transferString: (NSString * string); @end @interface B_ViewController: UIViewController / @property (nonatomic, weak agent properties) id< BToADelegate> delegate; @end B controller.M file: #import “B_ViewController.h” @interface (B_ViewController) @ property (nonatomic, strong); UITextField *bTextField; @end @implementation B_ViewController (void) viewDidLoad {[super viewDidLoad]; self.title = @ self.view.backgroundColor = “B”; [UIColor whiteColor]; self.view.backgroundCo Lor [UIColor = whiteColor]; self.bTextField = [[UITextField alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; self.bTextField.layer.borderColor [UIColor = grayColor].CGColor; self.bTextField.layer.borderWidth = 1; [self.view addSubview:self.bTextField]; UIButton *button [UIButton = buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal] [button setTitle:@ “; the value of A forState:UIControlStateNormal] [button addTarget:self”; action:@selector forControlEvents:UIControlEventTouchUpInside] [self.view (buttonAction:); AddSubview:button];} – (void) buttonAction: (UIButton * sender) {/ / judgement have agents and whether the response agent (self.delegate & &amp if; [self.delegate respondsToSelector:@selector (transferString:)] [self.delegate) {transferString:self.bTextField.text]}}; [self.navigationController popToRootViewControllerAnimated:YES]; @end
  3. The Block value of
    usage: reverse value:
    requirements: A-push to B, when B disappeared, there is a need to display the Label input from a TextField B in the A, then we need to use the reverse value. The A controller.M file: #import “A_ViewController.h” #import “B_ViewController.h” @interface (A_ViewController) @property (nonatomic, strong) UILabel *aLabel; @end @implementation A_ViewController (void) viewDidLoad {[super viewDidLoad]; @ self.title = “A”; self.view.backgroundColor [UIColor = whiteColor]; self.aLabel = [[UILabel alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30 self.aLabel.layer.borderColor)]; grayColor].CGColor = [UIColor; self.aLabel.layer.borderWidth = 1; [self.view addSubview:self.aLabel]; UIButton *button [UIButton = buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/ 2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “push to B” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents: UIControlEventTouchUpInside]; [self.view addSubview:button];} – (void) buttonAction: (UIButton * sender) {B_ViewController *bViewController = [[B_ViewController alloc] init]; __weak __typeof (self) weakSelf = self; / / block bViewController setBlock:^ (NSString receiving callback [*string) {weakSelf.aLabel.text = string;}]; [self.navigationController pushViewController:bViewController animated:YES];} B controller.H file: #import < UIKit/UIKit.h> / / The definition of a block typedef void (^BToAblock) (NSString *string); @interface B_ViewController: UIViewController / / block (nonatomic, copy) properties of @property BToAblock block; @end B controller.M file: #import “B_ViewController.h” interface (@property) @ B_ViewController (nonatomic, strong) UITextField *bTextField; @end @implementation B_ViewController (void viewDidLoad) {[super viewDidLoad]; @ self.title = “B”; self.view.backgroundColor [UIColor = whiteColor]; self.view.backgroundColor = [UIColor whiteColor]; self.bTextField = [[UITextField alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; self.bTextField.layer.borderColor = [UIColor grayColor].CG Color; self.bTextField.layer.borderWidth = 1; [self.view addSubview:self.bTextField]; UIButton *button [UIButton = buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “value A” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents:UIControlEventTouchUpInside] [self.view; addSubview:button];} – (void) buttonAction: (UIButton * sender Blcok) {/ * * value reverse value passing B to A / _block (self.bTextField.text); [self.navigationController popToRootView ControllerAnimated:YES];} @end
  4. The KVO value of
    usage: reverse value:
    requirements: A-push to B, when B disappeared, there is a need to display the Label input from a TextField B in the A, then we need to use the reverse value. The A controller.M file: #import “A_ViewController.h” #import “B_ViewController.h” @interface (A_ViewController) @property (nonatomic, strong) UILabel *aLabel @property (nonatomic, strong); B_ViewController *bViewController; @end @implementation A_ViewController (void) viewDidLoad {[super viewDidLoad]; @ self.title = “A”; self.view.backgroundColor [UIColor = whiteColor]; self.aLabel = [[UILabel alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].Bounds.size.width/2-50, 200, 100, 30)]; self.aLabel.layer.borderColor [UIColor = grayColor].CGColor; self.aLabel.layer.borderWidth = 1; [self.view addSubview:self.aLabel]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; Button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “push to B” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button]; / * * KVO to create three steps to write 1 registered observer 2 KVO callback 3 remove the observer * / / / B to A reverse, value / registered observer, the observer’s note: registration and to remove the corresponding, if removed and found no registered observer, the program will crash self.bViewController = [[B_ViewController alloc] init]; ” Self.bViewController addObserver:self forKeyPath:@ string options:NSKeyValueObservingOptionNew context:nil];} – (void) buttonAction: (UIButton * sender) {[self.navigationController pushViewController:self.bViewController animated:YES];} / / KVO – (void) observeValueForKeyPath: callback (NSString *) keyPath ofObject: (ID) object (change: NSDictionary< NSString id> * *, change) context: (void * context) {if ([keyPath isEqualToString:@ “string”]) {self.aLabel.text = self.bViewController.string;}} / / KVO removal (and notice as to remove) – (void) dealloc [self.bViewController removeObserver:self {forKeyPath:@ string @end}]; B controller.H file: #import < UIKit/UIKit.h> @int Erface B_ViewController: UIViewController @property (nonatomic, copy) NSString *string; @end B controller.M file: #import “B_ViewController.h” @interface (B_ViewController) @property (nonatomic, strong) UITextField *bTextField; @end @implementation B_ViewController (void) viewDidLoad {[super viewDidLoad]; @ self.title = “B”; self.view.backgroundColor [UIColor = whiteColor]; self.view.backgroundColor = [UIColor whiteColor] self.bTextField = [[UITextField; alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; self.bTextField.layer.borderColor [UIColor = grayColor].CGColor; self.bTextField.layer.borderWidth = 1; [self.view addSubview:self.bT ExtField]; UIButton *button [UIButton = buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “value A” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button];} – (void) buttonAction: (UIButton * sender) {/ / KVO / / self.bTextfield.text assigned to the current property in A / / monitor the current attribute self.string = self.bTextField.text; [self.navigationController popToRootViewControllerAnimated:YES] @end;}
  5. Notice of value passing
    usage: positive value
    demand: when A-push to B, there is a need to display the Label input from a TextField A in the B, then we need to use the positive value. Usage: reverse value:
    demand: A-push to B, when B disappears, there is a Label in A that needs to display the contents of a TextField input from B, then we need to use reverse value. We will pass the two values to a Demo, so the Label Textfield can be as follows: A controller.M file: #import “A_ViewController.h” #import “B_ViewController.h” @interface (A_ViewController) @property (nonatomic, strong) UITextField *aTextField; @end @implementation A_ViewController (void) viewDidLoad {[super viewDidLoad]; self.title = @ “A”; self.view.backgroundColor [UIColor = whiteColor]; self.aTextField = [[UITextField alloc] initWithFrame: CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; self.aTextField.layer.borderColor [UIColor = grayColor].CGColor; self.aTextField.layer.borderWidth = 1; [self.view addSubview:self.aTextField]; UIButton *button buttonWithType:UIButtonTypeCustom] = [UIButton; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “to B” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector / / receive notification (tzAction:) name:@ B2A object:nil];} – (void buttonAction: (UIButton * sender)) {/ / notice value is generally used for the return to the B / / now is A, positive value / / send notification method To write in the execution of B_ViewController *bViewController = [[B_ViewController alloc] method init] [[NSNotificationCenter defaultCenter]; postNotificationName:@ “A2B” object:nil userInfo:@{@ “key”: self.aTextField.text}] [self.navigationController pushViewController:bViewController; animated:YES];} / / callback notification (void) tzAction: – (NSNotification * sender) {self.aTextField.text sender.userInfo[@ = “key”];} / / remove Notification – (void) {dealloc [[NSNotificationCenter defaultCenter] removeObserver:self];} @end B controller.M file: #import “B_ViewController.h” @interface (B_ViewController) @property (nonatomic, strong) UITextField *bTextField; @end @implementation B_ViewController (void) viewDi DLoad {[super = viewDidLoad]; self.title @ self.view.backgroundColor = “B”; [UIColor whiteColor]; UIButton *button [UIButton = buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “value A” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents: UIControlEventTouchUpInside]; [self.view addSubview:button];} / / if is from A to B, to create a init method in the B.m, write monitor inside and the receiving container can be successfully created inside (because the program executes the init method and viewDidLoad method, when The past value start listening in init, if there is no creation of textField receiver, the transmission is not in the past, so to create the receiver in the init (life cycle issues); (instancetype) – init (self) {if = [super init]) {“NSNotificationCenter defaultCenter] addObserver:self selector:@selector (tzAction:) name:@ A2B object:nil]; self.bTextField = [[UITextField alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; self.bTextField.layer.borderColor [UIColor = grayColor].CGColor; self.bTextField.layer.borderWidth = 1; [self.view addSubview:self.bTextField];} return self;} / / receiving notification – (void) tzAction: (NSNotification * sender) {s Elf.bTextField.text sender.userInfo[@ = “key”];} / / remove Notification – (void) dealloc [[NSNotificationCenter defaultCenter] removeObserver:self] {/ / remove all; / / remove a / / [[NSNotificationCenter defaultCenter] removeObserver:self name:@ TZ object:nil];} / / send notification – (void) buttonAction: (UIButton * sender) {/ / B to A, the reverse value passing [[NSNotificationCenter defaultCenter] postNotificationName:@ “B2A” object:nil userInfo:@{@ “key” [self.navigationController: self.bTextField.text}]; popToRootViewControllerAnimated:YES]; @end}
  6. A single case of value passing
    usage: positive value
    demand: when A-push to B, there is a need to display the Label input from a TextField A in the B, then we need to use the positive value. Usage: reverse value:
    demand: A-push to B, when B disappears, there is a Label in A that needs to display the contents of a TextField input from B, then we need to use reverse value. We will pass the two values to a Demo, so the Label Textfield can be as follows: A controller.M file: #import “A_ViewController.h” #import “B_ViewController.h” #import “DanLi.h” @interface (A_ViewController) @ property (nonatomic, strong) UITextField *aTextField; @end @implementation A_ViewController (void) viewDidLoad {[super viewDidLoad]; Do any additional setup after loading / the view. @ self.title = “A”; self.view.backgroundColor = UIColor [whiteColor] = [[UITextField; self.aTextField alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)] self.aTextField.layer.borderColor = [UIColor; grayColor].CGColor; self.aTextFie Ld.layer.borderWidth = 1; [self.view addSubview:self.aTextField]; UIButton *button [UIButton = buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “to B” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button];} – (void) viewWillAppear: (BOOL animated) {/ / single cases of value passing B to A (two can value) DanLi *danli = [[DanLi alloc] init]; self.aTextField.text = danli.value;} – (void) buttonAction: (UIButton * SEN) Der {/ / single value A to B cases (can two value) DanLi *danli = [DanLi sharedDanLi]; danli.value = self.aTextField.text; B_ViewController = *bViewController [[B_ViewController alloc] init]; [self.navigationController pushViewController: bViewController animated:YES];} B controller.M file: #import “B_ViewController.h” #import “DanLi.h” @interface (B_ViewController) @property (nonatomic, strong) UITextField *bTextField @end; @implementation B_ViewController (void) viewDidLoad {[super viewDidLoad]; @ self.title = “B”; self.view.backgroundColor [UIColor = whiteColor]; self.view.backgroundColor = [UIColor whiteColor]; self.bTextField = [[UITextField alloc] initWith Frame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; self.bTextField.layer.borderColor [UIColor = grayColor].CGColor; self.bTextField.layer.borderWidth = 1; [self.view addSubview:self.bTextField]; UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “value A” forState:UIControlStateNormal] (action:@selector addTarget:self; [button buttonAction: forControlEvents:UIControlEventTouchUpInside] [self.view self.bTextField.text); addSubview:button]; [DanLi = sharedDanLi].value;} – (void) buttonAction: (UIButton * sender) to A [DanLi sharedDanLi].value {//B = self.bTextField.text; [self.navigationController popToRootViewControllerAnimated:YES];} @end singleton class.H file: #import < Foundation/Foundation.h> DanLi NSObject @ interface: / / create a singleton / / if a single thread can be used in nonatomic, how to use atomic if thread, to ensure there is only one in the call, or in the multi thread inside if the attribute invokes a plurality of methods to modify the single case class will conflict with the @property (atomic, copy) NSString + *value (DanLi * sharedDanLi); @end; singleton class.M file: #import “DanLi.h” static DanLi *danli = nil; implementation method of @implementation DanLi / /, to determine whether the air, is to create a global instance to It is + (DanLi * sharedDanLi) {if (Danli = = Nil) {Danli = [[DanLi alloc] init] return Danli;};} / / avoid alloc/new to create —&gt new instance variables; add a mutex + (ID) allocWithZone: (struct * _NSZone) zone (self) {@synchronized {if (Danli = nil) {Danli}} = [super allocWithZone:zone]; return Danli;} / / avoid copy, need to implement the NSCopying protocol (ID) – copyWithZone: (NSZone * zone) {return self}; @end
  7. The KVC value of
    usage: positive value
    demand: when A-push to B, there is a need to display the Label input from a TextField A in the B, then we need to use the positive value. The A controller.M file: #import “A_ViewController.h” #import “B_ViewController.h” @interface (A_ViewController) @property (nonatomic, strong) UITextField *aTextField; @end @implementation A_ViewController (void) viewDidLoad {[super viewDidLoad]; Do any additional setup after loading / the view. @ self.title = “A”; self.view.backgroundColor [UIColor = whiteColor]; self.aTextField = [[UITextField alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; self.aTextField.layer.borderColor [UIColor = grayColor].CGColor; self.aTextField.layer.borderWidth = 1; [self.view addSubview:self.aTextField]; UIButton *button = [UIButton buttonWithType:UIButtonT YpeCustom]; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “to B” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button];} – (void) buttonAction: (UIButton * sender) {B_ViewController *bViewController = [[B_ViewController alloc] init]; / * * KVC value: here only A to B (because B had initialized in the A page) B has a string attribute with the B object to the B attribute assignment (review OC KVC assignment is to understand the forkey here) To be consistent with the B attribute name (also can use @ “_string”) because it is attribute to the B property of string * / / / setValue:self.aTextField.text forKey:@ value [bViewController “string”]; [self.navigationController pushViewController:bViewController animated:YES];} @ end B controller.H file: #import < UIKit/UIKit.h&gt @interface; B_ViewController: UIViewController @property (nonatomic, copy) NSString *string; @end the B controller.M file: #import “B_ViewController.h” @interface B_ViewController (@end @implementation B_ViewController) – (void) viewDidLoad {[super viewDidLoad]; @ self.title = “B”; self.view.backgroundColor [UIColor = whiteColor]; self.view.backgroundColor = [UIColor whiteColor]; UILabel *bLabel = [[UILabel alloc] initWithFrame:CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 200, 100, 30)]; bLabel.layer.borderColor [UIColor = grayColor].CGColor; bLabel.layer.borderWidth = 1; [self.view addSubview:bLabel]; UIButton *button [UIButton = buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake ([UIScreen mainScreen].bounds.size.width/2-50, 280, 100, 30); [button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; [button setTitle:@ “value A” forState:UIControlStateNormal]; [button addTarget:self action:@selector (buttonAction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button]; / / KVC receiving value bLabel.tex T = self.string;} – – (void) buttonAction: (UIButton *) sender {[self.navigationController popToRootViewControllerAnimated:YES];} @end

Well, this has basically introduced the value of the page, and I believe you have a certain understanding of the value of the page pass, go to practice!