In my WhatToEditViewController, I created an NSString property called whattoedit. When the user presses a certain button, whattoedit gets assigned to a string.
@interface WhatToEditViewController : UIViewController
@property (nonatomic, strong) NSString * whattoedit;
@end
#import "WhatToEditViewController.h"
Implementation:
@implementation WhatToEditViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)TappedMorning:(id)sender {
self.whattoedit = @"Morning";
}
- (IBAction)TappedAfternoon:(id)sender {
self.whattoedit = @"Afternoon";
}
- (IBAction)TappedEvening:(id)sender {
self.whattoedit = @"Evening";
}
(I checked this part of my program works :/) Also when the user presses the button, a new view controller called SettingsTableViewController gets pushed in. What I want to do is set the title of the navigation bar of SettingsTableViewController as WhatToEditViewController's whattoedit property.
Here is SettingsTableViewController's implementation:
#import "SettingsTableViewController.h"
#import "WhatToEditViewController.h"
@interface SettingsTableViewController ()
@end
@implementation SettingsTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
WhatToEditViewController * editMode = [[WhatToEditViewController alloc] init];
self.navigationController.navigationBar.topItem.title = editMode.whattoedit;
}
Oddly, the navigation bar title turns into (null). Should the navigationBar.title code be in the viewDidLoad?