I'm doing an application where there are several phrases that are stored in an array plist, and I would be able to navigate between these sent开发者_运维知识库ences using buttons to go back to previous or next it is possible to do using plist, I would like to help! Thank you.
NSMutableArray *dictDitados;
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathComponent:@"Ditados.plist"];
NSDictionary *plistData = [[NSDictionary dictionaryWithContentsOfFile:finalPath] retain];
NSDictionary *ditados = [plistData objectForKey:@"Sentences"];
NSMutableArray *selection = [[ditados objectForKey:@"phrases"] mutableCopy];
// Select and display currently selected record from the array.
dictDitados = [selection objectAtIndex:0];
It is definitely possible, you just have to display the object at the next index and make sure you don't go outside the bounds of your array. I'm not really sure what your question is outside of that.
Also you need to alloc your array
NSMutableArray *selection = [[NSMutableArray alloc]init];
I would also set the value from the array to a string
NSString *dictDitados = [selection objectAtIndex:0];
精彩评论