How to add to an NSDictionary

前端 未结 6 1341
无人及你
无人及你 2020-12-12 19:00

I was using a NSMutableArray and realized that using a dictionary is a lot simpler for what I am trying to achieve.

I want to save a key as a NSSt

6条回答
  •  既然无缘
    2020-12-12 19:23

    For reference, you can also utilize initWithDictionary to init the NSMutableDictionary with a literal one:

    NSMutableDictionary buttons = [[NSMutableDictionary alloc] initWithDictionary: @{
        @"touch": @0,
        @"app": @0,
        @"back": @0,
        @"volup": @0,
        @"voldown": @0
    }];
    

提交回复
热议问题