I have my view controller named SecondViewController and when user selects which article wants to read, I want to navigate to ThirdViewController and pass NSDictionary with article data.
- (void) touchButtonBlock:(NSInteger) select
{
NSLog(@"touchButtonBlock");
NSDictionary *dict;
switch (select) {
case 0:
{
NSMutableDictionary *tmpDict = [[NSMutableDictionary alloc] init];
NSMutableDictionary *val = [[NSMutableDictionary alloc] init];
[val setObject:@"article360.html" forKey:@"page"];
[val setObject:@"img.png" forKey:@"img"];
[val setObject:@"art1" forKey:@"name"];
[tmpDict setObject:val forKey:[NSNumber numberWithInt:0]];
val = [[NSMutableDictionary alloc] init];
[val setObject:@"article360.html" forKey:@"page"];
[val setObject:@"img.png" forKey:@"img"];
[val setObject:@"art2" forKey:@"name"];
[tmpDict setObject:val forKey:[NSNumber numberWithInt:1]];
dict = [NSDictionary dictionaryWithDictionary:tmpDict];
//[tmpDict release];
//[val release];
break;
}
NSDictionary *immDict = [NSDictionary dictionaryWithDictionary:dict];
ArticleSelectListViewController *selectorView = [[ArticleSelectListViewController alloc] initWithArticlesData:immDict];
[self.navigationController pushViewController:selectorView animated:YES];
[selectorView release];
}
Here I assing NSDicitionary:
- (id)initWithArticlesData:(NSDictionary *)data
{
self = [super initWithNibName:nil bundle:nil];
if (self)
{
articles = data;
...
}
But in the other functions that are being called after user interaction articles variable seems to be incorrect - it doesn't contain my data.
Where do I make mistake ?