2012-02-19 5 views
1

인터넷에서 많은 검색을 한 후에도 여전히 내 plist보기에 내 plist를 넣는 데 문제가 있습니다. 내가 잘못 뭐하는 거지 ....Plist에있는 항목을 볼 수 없습니다.

- (void)viewDidLoad 
NSString *path = [[NSBundle mainBundle] pathForResource:@"myPlist" ofType:@"plist"]; 
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path]; 
self.myPlist = dict; 


-(NSString *) pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component 
NSMutableArray *temp = [[NSMutableArray alloc] initWithArray:myPlist.allKeys]; 
return [temp objectAtIndex:row]; 

결과는 그냥 "루트"를 보여줍니다

<dict> 
<key>root</key> 
<dict> 
    <key>roof</key> 
    <array> 
     <string>80</string> 
     <string>100</string> 
    </array> 
</dict> 

내 코드는 다음과 같습니다이 내 PLIST입니까? 어떤 아이디어라도 높이 평가할 수 있습니다.

답변

0

데이터 소스 대리자를 구현 했습니까?

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView 

이보기

: 보조 노트, 왜 당신은 변경 가능한 배열 온도를 작성하는 등 또한

When to use a plist, UIPickerView datasource help

? ARC를 사용하지 않는 경우 필요하지 않아야합니다. 궁금한 점이 있으면 알려주세요.

+0

hello daltoniam, 도와 주셔서 감사합니다. 이미 해결책이 있습니다. 문제는 plist가 원래 사전이고 배열이 아니었기 때문에 .h 파일에서 NSDictionary 변수 (NSDicionary * myplist)를 사용한 다음 내 .m에 NSDicitionary로 내 피커 뷰 메서드를 사용했습니다. – Japa

관련 문제