NSMutableDictionary

976 단어 Objective-C
//
//  main.m
//  NSMutableArray
//
//  Created by rayln on 13-9-7.
//  Copyright (c) 2013  rayln. All rights reserved.
//

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"v1", @"k1", @"v2", @"k2", @"v3", @"k3", nil];
        // dic     key value
        [dic setObject:@"v4" forKey:@"k4"];
        
        //      
        [dic removeObjectForKey:@"k3"];
        //               
        [dic addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys:@"v5", @"k5", nil]];
        
        NSLog(@"%@", dic);
        
    }
    return 0;
}


좋은 웹페이지 즐겨찾기