开发者

Navigate between sentences from plist !

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜