// // SecondViewController.m // MultiView2 // // Created by UEC on 8/6/15. // Copyright (c) 2015年 uec. All rights reserved. // #import "SecondViewController.h" @interface SecondViewController () @end @implementation SecondViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. NSUserDefaults *n1 = [NSUserDefaults standardUserDefaults]; self.myLabel.text = [n1 valueForKey:@"MyName"]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ - (IBAction)onEnter:(id)sender { NSUserDefaults *n1 = [NSUserDefaults standardUserDefaults]; [n1 setObject:self.myTextField.text forKey:@"MyName"]; self.myLabel.text = self.myTextField.text; } @end