I have been struggling with that for some time. I have a tab bar application. In `SecondView` I define number2 and save it to `NSUserDefaults` as I want it to be remembered by the program at the next time the app is open. In the `FirstView` I want to do some calculation (and display the answer) that include number2 saved earlier. I can't get it working. In the code, I left only things that are working so far. Any help will be greatly appreciated.

FirstViewController.h

```
#import <UIKit/UIKit.h>
#import "SecondViewController.h"

@interface FirstViewController : UIViewController {
IBOutlet UILabel *labelAnswer;
}
-(IBAction)buttonCalc;
@property(nonatomic, retain) UILabel *labelAnswer;

@end

```

FirstViewController.m

```
#import "FirstViewController.h"
#import "SecondViewController.h"

@interface FirstViewController ()

@end

@implementation FirstViewController

@synthesize labelAnswer;

-(IBAction)buttonCalc {
    float number1 = 2;

//what should I put here (or somewhere else) to get number2 saved in second view?

    float answer = number1;// + number2
    labelAnswer.text = [[NSString alloc] initWithFormat:@"%f", answer];
}

```

SecondViewController.h

```
#import <UIKit/UIKit.h>

@interface SecondViewController : UIViewController {
    IBOutlet UITextField *textNumber2;
    NSUserDefaults *defaults;
}

-(IBAction)buttonSave;
@property(nonatomic, retain) UITextField *textNumber2;
@end

```

SecondViewController.m

```
#import "SecondViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController

@synthesize textNumber2;

-(IBAction)buttonSave {
    //saving my data
    NSString *saveNumber2 = textNumber2.text;
    defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:saveNumber2 forKey:@"savedNumber2"];
    [defaults synchronize];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    //loading my data
    defaults = [NSUserDefaults standardUserDefaults];
    NSString *loadNumber2 = [defaults objectForKey:@"savedNumber2"];
    [textNumber2 setText:loadNumber2];
}

```