您的位置:首页 > 其它

iphone开发 如何在NSMutableDictionary中放入基本数据类型

2012-08-04 11:44 471 查看
NSMutableDictionary中只能放入对象,不能放入基本类型,这一点请参考java的Map系列。。。 然则NSInteger。。不是对象。。。。NSNumber才是,所以应该这样放的:

NSInteger aInteger;
NSMutableDictionary *dic=[[NSMutableDictionary alloc initWithCapacity:10];
[dic setObject:[NSNumber numberWithInteger:aInteger]forKey:@"TheKey"];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: