Ok, I am new to Objective-C/iPhone programming, so there are some questions arising when I try to do things that would be quite easy in C++.
I´m building a tab bar based iPhone application with three views, one for each tab bar button. In the first view the user builds a NSdictionary, which the second view shall display as a graph. To access this dictionary, I save it to a .plist in the first view controller, then bulding a new dictionary from this .plist in the second.
To make the graph view, i use s7graphview, which is initialized etc in SecondViewController, but has its own .h and .m files, which I import. The method to load values into the graph (which is from the created dictionary), is implemented in the GraphInfoList.m file, which means I have to make another dictionary from the .plist to access the data. How can I access the already created dictionary?
While doing this, I also made a method “dataFilePath”, which returns the file path of the .plist, which I use to load the data into a dictionary. I have found no other way of implementing this method than to copy/paste it to every .m file that uses it! There´s got to be another way?
An while I´m at it: where are the objects in iPhone programming? The .m files is classes, aren´t they? I never create a new object using the new operator, and I thought I may would be able to access the methods if I had any object to call (like [FirstViewController dataFilePath] ).
I really don´t know how this is handled in Obj-C/Cocoa, and I don´t know what to search for to find the answers. Help would be really appreciated.
I had the same problem using s7graphview in a different view controller. I solved it by adding an NSDictionary as a property in the AppDelegate and when the viewwilldisappear method fires i added this code:
I think it isn’t the only way to do it but you will remove the .plist code who slows you app