Created
May 24, 2012 04:42
-
-
Save abrahamjso/2779486 to your computer and use it in GitHub Desktop.
read plist iOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)plistVista | |
{ | |
NSString *path = [[NSBundle mainBundle] bundlePath]; //inicializamos el path | |
NSString *plistName = @"vistas.plist"; //Guardamos la direccion del archivo a leer | |
NSString *finalPath = [path stringByAppendingPathComponent:plistName]; //Leemos la direccion, | |
//guardandola en un string | |
NSDictionary *plistData = [NSDictionary dictionaryWithContentsOfFile:finalPath]; //inicializamos el diccionario | |
int cplistData = plistData.count; //Contamos las filas que contiene nuestro plis de nodo padre | |
//Essto nos servira para leer cada linea | |
for(int i = 0; i < cplistData; i++) //Inicializamos el for para su lectura | |
{ | |
NSDictionary *vistaMenu = [plistData objectForKey:[NSString stringWithFormat:@"v%d", i+1]]; //Abrimos el | |
//diccionario que tiene como nombre v[numero de la lista] | |
NSString *nombreVista = [vistaMenu objectForKey:@"nombre"]; //Guardamos el valor en la variable | |
NSLog(@"%@", nombreVista); //La imprimimos | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment