Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何从字典中检索数组_Iphone_Objective C_Nsmutablearray_Nsarray_Nsdictionary - Fatal编程技术网

Iphone 如何从字典中检索数组

Iphone 如何从字典中检索数组,iphone,objective-c,nsmutablearray,nsarray,nsdictionary,Iphone,Objective C,Nsmutablearray,Nsarray,Nsdictionary,我的Sqlite表1.DetailsID和2.Detailstype中有两列 我存储了id:int和detailstype:varchar的值 在sqlite select query中将带有字符串的id设置为 while(sqlite3_step(selectPrefer) == SQLITE_ROW) { NSString *detailsString = [NSString stringWithUTF8

我的Sqlite表1.DetailsID和2.Detailstype中有两列

我存储了id:int和detailstype:varchar的值

在sqlite select query中将带有字符串的id设置为

while(sqlite3_step(selectPrefer) == SQLITE_ROW)
            {                
                NSString *detailsString = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectPrefer, 1)];
                int detailsId = (int)sqlite3_column_int(selectPrefer, 0);

                [detailsData setObject:detailsString forKey:[NSNumber numberWithInt:detailsId ]];

            }
我有这样一本可更改的词典:

(


         0 = "˚F";
        12 = Activity;
        11 = BM;
        7 = "Heart Rate";
        6 = "Nose Problem";
        2 = Rx;
        1 = BP;
        10 = Food;
        9 = "Stress Level";
        8 = Glucose;
        5 = "Pain Level";
        4 = Weight;
        3 = Events;
}
i can get arrays using allKeys & allValues but these are not in order
现在我想要像这样的独立数组

       {
             0
1
2
3
4
5
6
7
8
9
10
11
12

        )
值和键均按键的升序排列

(
            "˚F";
         Activity;
         BM;
         "Heart Rate";
         "Nose Problem";
         Rx;
         BP;
         Food;
         "Stress Level";
         Glucose;
         "Pain Level";
         Weight;
         Events;
)
无需对sqlite查询进行任何修改
-如何提前终止

您应该使用的allKeys和allValues属性:

allKeys返回包含字典键的新数组

allValues返回包含字典值的新数组

试试这个:

NSArray *keysArray = [yourDictionnay allKeys];
NSArray *valuesArray = [yourDictionnay allvalues];
希望这有帮助,
Vincent

您应该使用的allKeys和allValues属性:

allKeys返回包含字典键的新数组

allValues返回包含字典值的新数组

试试这个:

NSArray *keysArray = [yourDictionnay allKeys];
NSArray *valuesArray = [yourDictionnay allvalues];
希望这有帮助,
Vincent

您需要所有值和所有键

NSArray *values = [dictionary allValues];
NSArray *keys  =  [dicitoary allKeys];

您需要所有值和所有键

NSArray *values = [dictionary allValues];
NSArray *keys  =  [dicitoary allKeys];

我想按升序检索键,如(0,1,2,3,…,11,12)。怎么做?看看这个问题:我想要按AllKeys排序的所有值我想要按升序检索键,如(0,1,2,3,…,11,12)。怎么做?看看这个问题:我想要按allKeys排序的所有值我想要按allKeys排序的所有值我想要按allKeys排序的所有值