1
インターネットで多くの検索をした後、私のピッカーのビューに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のでしょうか?どんなアイデアでも大歓迎です。
hello daltoniam、ご協力いただきありがとうございます。既に解決策があります。問題は、plistは元々辞書であり、配列ではないので、私の.hファイルではNSDictionary変数(NSDicionary * myplist)を使用し、次に私はNSDicitionaryでピッカービューメソッドを働かせました。 – Japa