I am initialing a dictionary in viewDidLoad and using it to create table view cells.
The first load works fine. But as soon as I scroll the table view to see the item (not displayed at the bottom) the app crashes. Through the Debugger I noticed the address of the dictionary item "rootItemsDict" changes when I did the scroll. Not able to figure out why that is. From my understanding the address of an object initialized once should remain same, at least within the given class instance. Any thoughts?
- (void)viewDidLoad {
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"menu" ofType:@"plist"];
rootItemsDict = [NSDictionary dictionaryWithContentsOfFile:path];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *title = (NSString *)[[[rootItemsDict objectForKey:@"rootMenuItems"] objectAtIndex:row] objectForKey:@"heading"];