处理把BOOL值存入NSMutableDictionary,从NSMutableDictionary中取出BOOL值

来源:互联网 发布:千里眼远程监控软件 编辑:程序博客网 时间:2024/05/22 05:14

原文链接:

http://blog.csdn.net/z343929897/article/details/7964057

将一个BOOL值插入到NSMutableDictionary中,把BOOL值从NSMutableDictionary中取得出来的用法:

项目要讲BOOL类型的值插入到一个NSMutableDictionary。

首先将 BOOL 包装到 NSNumber中:

NSNumber *boolNumber = [NSNumber numberWithBool:YES]

取得BOOL值:

BOOL b = [boolNumber boolValue];

或者通过这种方式:

NSValue *boolValue = [NSValue value:pointerToBool withObjCType:@encode(BOOL*)];

BOOL *b = [boolValue pointerValue];


0 0
原创粉丝点击