for each loop in Objective-C for accessing NSMutable dictionary

前端 未结 7 502
忘掉有多难
忘掉有多难 2020-11-30 16:45

I am finding some difficulty in accessing mutable dictionary keys and values in Objective-C.

Suppose I have this:

NSMutableDictionary *xyz=[[NSMutabl         


        
7条回答
  •  伪装坚强ぢ
    2020-11-30 17:03

    If you need to mutate the dictionary while enumerating:

    for (NSString* key in xyz.allKeys) {
        [xyz setValue:[NSNumber numberWithBool:YES] forKey:key];
    }
    

提交回复
热议问题