NSDictionary の順序を維持するために、この Ordered Dictionaryソリューションを使用する投稿を見ました。
json オブジェクトから取得したのと同じ順序で保存しますが、UIPickerView の値を使用する必要があるため、次のように記述しました。
OrderedDictionary *countryStates = [businessInfo objectForKey:@"allowedStates"];
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
NSString *stateShort = [countryStates keyAtIndex:row ];
return [countryStates objectForKey:stateShort];
}
しかし、私は得る:
[__NSCFDictionary keyAtIndex:]: unrecognized selector sent to instance
- なぜ私はそれを得るのですか?
- 注文を台無しにすることなく、UIPickerView の注文済み辞書を使用できる他の方法はありますか?