我们如何在NSMutableDictionary中存储Float值

Sum*_*ngh -1 nsmutabledictionary ios

- (void)buttonSave:(UIButton *)bttnSave
{
    UILabel *lbl = (UILabel *)[self.view viewWithTag:kTagLblText];
    [dicStore setValue:lbl.textColor forKey:@"Text Color"];

    // fltValue is float type 
    [dicStore setObject:fltValue forKey:@"font"];

    [dicStore setValue:strtextView forKey:@"Text Style"];
    [arrStoreDic addObject:dicStore];
}
Run Code Online (Sandbox Code Playgroud)

如果我们可以存储这个,那么任何人都可以帮助我做

tro*_*foe 8

只是:

dicStore[@"font"] = @(fltValue);
Run Code Online (Sandbox Code Playgroud)

然而,令人不安的dicStore是你想要存储到数组中的实例变量,这让我相信你最终会得到一个包含相同值的相同字典的数组.

而是每次创建一个新的字典并将其存储到数组中(当然,除非其他代码需要查看此字典).目前的实施非常脆弱.