Method one:
Open the project we just created in last post.
Step 1:
Select the AppDelegate.h file, add your
variable
Step 2:
Synthesize the object in AppDelegate.m file and
initialize it when the application becomes active:
Step 3
Set value to the variable, in ViewController.m
file, in secondPageBtnPress method, import “AppDelegate.h”.
Step 4
Get the value in the second page, in
“SecondPage_ViewController.h”, define a IBoutlet for the label.
Then
connect the label to IBOutlet, click “SecondPage_ViewController.xib”, Right click the “File owner” icon, drag and drop to the “Second Page” label,
select the “label” in the popup.
Step 5
Get the value and set to the “Second Page” label
In “SecondPage_ViewController.m”, import “AppDelegate.h”, synthesize the label, and in the viewDidLoad method to get the value.
No comments:
Post a Comment