dimanche 16 novembre 2014

NSDictionary data to another UIViewController while using a UINavigationController


Vote count:

0




I have seen similar questions asked on this site and I believe I have followed what was advised, however I can't seem to have it working properly. Here is the sample of the first controller .m



@interface JourneyPlannerController : UITableViewController <UITextFieldDelegate, UITableViewDataSource, UITableViewDelegate>
{
NSMutableDictionary * routesDictionary;
}

@property (nonatomic, strong) NSMutableDictionary * routesDictionary;


And the .h



- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

{
if ([[segue identifier] isEqualToString:@"SelectRouteSegue"])
{
SelectRouteController * selectRoutes = [[SelectRouteController alloc]init];
selectRoutes.diction = self.routesDictionary;
UINavigationController *navController= [segue destinationViewController];
NSLog(@"my diction:%@", selectRoutes.diction);
//At this point I see that the values are indeed in selectRoutes.diction
navController = [[UINavigationController alloc] initWithRootViewController:selectRoutes];
}
}


And in the second controller .h



@interface SelectRouteController : UITableViewController
{
NSMutableDictionary * diction;

}
@property (nonatomic, strong) NSMutableDictionary * diction;


The second controller .m



@synthesize diction;

- (void)viewDidLoad
{
[super viewDidLoad];

self.title = @"Select";

NSLog(@"New Data: %@",diction);
//I constantly get null values.
routesArray = [diction objectForKey:@"routes"];
}


What is the cause of the null value of my NSMuableDictionary diction in the second controller?



asked 31 secs ago







NSDictionary data to another UIViewController while using a UINavigationController

Aucun commentaire:

Enregistrer un commentaire