So, I'm very new to iOS/Obj-C and Xcode and am trying to learn by building a simple tabbed view application which takes some user variables, moves the user to the next view and displays the variables.
Currently, I have the first view - where a user selects two dates. I have successfully logged those 2 dates to the console. I haven't quite understood the concept of moving between views yet.
What I would like help with is - inside the - (IBAction)submitDates function, moving the user to the next view and passing the variables across to that view too - and simply logging the variables to the console.
Note: The second view files (JPSecondViewController.m and JPSecondViewController.h have not been touched yet).
Any help/guidance much appreciated in advance!
My JPFirstViewController.m file
// JPFirstViewController.m
// Vacay
//
#import "JPFirstViewController.h"
#import "JPSecondViewController.h"
@interface JPFirstViewController ()
@end
@implementation JPFirstViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)submitDates {
//Save the selected date variables
NSDate *dateFromPicker = [_fromDate date];
NSDate *endDateFromPicker = [_endDate date];
NSLog(@"From date: %@ and end date: %@", dateFromPicker, endDateFromPicker);
//Move user to second view controller
}
@end
my JPFirstViewController.m file
// JPFirstViewController.h
// Vacay
/
#import <UIKit/UIKit.h>
#import "JPSecondViewController.h"
@interface JPFirstViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIDatePicker *endDate;
@property (strong, nonatomic) IBOutlet UIDatePicker *fromDate;
- (IBAction)submitDates;
@end