objective
1for (int c = 0; count >= c; c++) { 2 //dictionaryのkeyにする文字列を作成 3 NSString *Int; 4 NSString *dicKey; 5 Int = [NSString stringWithFormat:@"%d", c]; 6 dicKey = [Int stringByAppendingString:[titleArray objectAtIndex:count - 1]]; 7 8 //questionDicに保存 9 questionDic = [NSMutableDictionary dictionaryWithObject:[questionArray objectAtIndex:c] forKey:dicKey]; 10 11 //answerDicに保存 12 answerDic = [NSMutableDictionary dictionaryWithObject:[answerArray objectAtIndex:c] forKey:dicKey];
こんな感じでNSDictionaryのキーに変数を使って文字列を保存してみました。
objective
1for (int c = 0; a >= c; c++) { 2 //dictionaryのkeyになる文字列を作成 3 Int = [NSString stringWithFormat:@"%d", c]; 4 dicKey = [Int stringByAppendingString:[titleArray objectAtIndex:cellPath]]; 5 }
保存した後に、こんな感じでさっき使ったものと同じキーを作成して、文字列を取り出そうとしたところ、最後に保存したもの以外nulが返ってきます。
どうしてでしょうか?
少々わかりにくかもしれませんが、お願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/08/10 08:36