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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2021-06-14
  • 2021-10-11
  • 2021-08-02
相关资源
相似解决方案