I want to display a navigationBar title from a NSDictionary. In the firstDetailViewController I have a UIImageView which changes depending on the row selected in the pushing tableview controller.
I want to use these changing images to determining what the navigationBar title (among other things) will be in a secondDetailViewController which is pushed by the firstDetailViewController.
Here is my code for the firstDetailViewController;
in my secondDetailViewController's viewDidLoad my code is;
This is not working, only the TitleA shows up no matter what.
Can I use a UIImage as a condition and if so what am I doing wrong.
Thanks for the help.
I want to use these changing images to determining what the navigationBar title (among other things) will be in a secondDetailViewController which is pushed by the firstDetailViewController.
Here is my code for the firstDetailViewController;
Code:
-(IBAction)pushView:(id) sender{
secondDetailViewController *secondDetail = [[secondDetailViewController alloc] init];
if ((self.imageView.image = [UIImage imageNamed:@"0002.jpg"])) {
NSMutableDictionary *myDictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"TitleA", @"headerkey2", nil];
secondDetail.myDictionary = myDictionary;
NSLog(@"%@", [mapDictionary objectForKey:@"headerkey2"]);
}
else if((self.imageView.image = [UIImage imageNamed:@"0003.jpg"])) {
NSMutableDictionary *myDictionary = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"TitleB", @"headerkey2",nil];
secondDetail.myDictionary = myDictionary;
NSLog(@"%@", [mapDictionary objectForKey:@"headerkey2"]);
}
[self.navigationController pushViewController:secondDetail animated:YES];
}
in my secondDetailViewController's viewDidLoad my code is;
Code:
self.title = [(NSMutableDictionary *)myDictionary objectForKey:@"headerkey2"];
This is not working, only the TitleA shows up no matter what.
Can I use a UIImage as a condition and if so what am I doing wrong.
Thanks for the help.
Last edited by a moderator: