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


将一个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];


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM