2012-04-28 2 views

답변

15

이 시도 :

NSString *path = [[NSBundle mainBundle] pathForResource:@"PlistX" ofType:@"plist"]; 
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path]; 
int number = [[[[dict objectForKey:@"One"] objectForKey:@"Two"]objectForKey:@"Three"] intValue]; 
NSLog(@"%d",number);  
3

1 NumberX = 값을 만들 것이라고 궁금 해서요) 가져 오기 데이터 (즉, NSMutableDictionary *를) plist에서 디스크로 저장 :

NSMutableDictionary *dictionary = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListMutableContainers format:NULL errorDescription:&error]; 

2) 사전에서 필요한 개체를 가져옵니다.

//in your case 
NSNumber *tmpNumber = [[[dictionary objectForKey:@"One"] objectForKey:@"Two"] objectForKey:@"Three"]; 
// convert to int 
int NumberX = [tmpNumber intValue]; 
+0

아픈 나중에 시도, 빠른 답변 감사합니다. – akuritsu

관련 문제