是否可以将Firebase数据加载到UIPickerView中? 这就是我所拥有的并且它有效但我想将某个Firebase快照值加载到选择器而不是显示" 0"," 1"," 2"
if ([self.view.restorationIdentifier isEqualToString:@"picker_id"]){
if ([Settings integerForKey:@"type"] == 4) {
{
// Database
Firebase *ref = [[Firebase alloc] initWithUrl: @"https://firebaseio.com/example"];
// Read data and react to changes
[ref observeEventType:FEventTypeValue withBlock:^(FDataSnapshot *snapshot) {
}];
}
pickerDistanceData = @[@"0",
@"1",
@"2",
@"3"];
}
}
我是否必须将snapshot.value设置为等于选择器中的某个索引?
答案 0 :(得分:2)
NSDictionary *object=[snapshot.value objectForKey:@"Your Key"];
id var=@1;
for(var in object)
{
//put data to your pickerDistanceData
}