将2个浮点数值存储在一起,然后将它们一起检索到IOS Development

时间:2013-11-26 02:36:30

标签: ios objective-c nsuserdefaults

我将如何执行此操作我尝试将浮动数据存储在自己的数组中,然后在检索它们时将它们分配给单独的数组。什么会比NSuserdefualts

更好
 for (int i=0; i<10; i++) {
    NSString *keys = [NSString stringWithFormat:@"key%d", i];
    NSObject * object = [prefs objectForKey:keys];
    if(object != nil){
        NSLog(@"There is a a saved value for %@", keys);
    }else{

        [[NSUserDefaults standardUserDefaults] setObject:coords forKey:keys];
        NSLog(@"Saved value %f , %f ... in slot %@",key1, key2 ,keys);
        break;

    }
}

0 个答案:

没有答案