Dear Developers,
I am trying to integrate a question/answer section to one of my apps.
I wanted to use a Utility style application where the question is loaded as a Uilable in the first view, and the answer is loaded in the flippedview.
I was hoping to load the question and answer data from a plist, and integrate a shuffle option so that the questions can be mixed up.
Is the plist method suitable here? does anybody have experience of making this sort of app? are there any examples on the web/in books where i could see some source code?
Your help is most apprecaited.
j
Update:
OK - i have tried to make this work.
Here is my plist (DataDetail1.plist):
Root...............................(Array)
........Item 0.....................(Dictionary)
.................Question..........(string) ///Question text////
.................Answer............(string) ///Answer text/////
........Item 2.....................(Dictionary)
.................Question..........(strings) //Question text////
.................Answer............(strings) //Answer text/////
I was thinking that i could declare the plist as an NSarray:
- (void)viewDidLoad {
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"DataDetail1" ofType:@"plist"]; //Defines path for DATA For ARRAY//
NSArray* tmpArray = [[NSArray alloc]
initWithContentsOfFile:path]; //initialises the contents of the ARRAY with the PLIST"
self.DataList1 = tmpArray;
[tmpArray release];
Then assign a Key to the UILable in the first view;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
Label1.text = [DataList1 objectForKey:Question_KEY];
It is at this point that i hit trouble - i can't use the 'objectForKey' method with an NSArray.
How do i get this to work?
j
p.s.
once this is working, what code would i need to make the flippedView load the 'Answer' key from a given Item within the Plist?