macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

removeObjectForKey:

INDEX>Foundation>NSMutableDictionary>

変更可能な辞書からキーを探してその項目を削除します
-(void)removeObjectForKey:(id)aKey

解説

変更可能な辞書からキー(aKey)を探してその項目を削除します。

返り値

( void )

なし

引数

( id )aKey

キー

クラス

NSMutableDictionary

Instance Methods

使用可能

10.0

参照

- removeAllObjects
- removeObjectsForKeys:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSDictionary *dic = 
        [NSDictionary dictionaryWithObjectsAndKeys:
        @"a",@"あ",
        @"i",@"い",
        @"u",@"う",nil];
NSMutableDictionary *aMutableDictionary = [ NSMutableDictionary dictionaryWithCapacity:1 ];
[aMutableDictionary addEntriesFromDictionary:dic];
[aMutableDictionary removeObjectForKey:@"あ"];
NSLog([aMutableDictionary description]);
}

@end