Objective-C dictionary inserting a BOOL

前端 未结 6 725
说谎
说谎 2020-12-13 06:01

OK, I\'m a little confused. It\'s probably just a triviality.

I\'ve got a function which looks something like this:

- (void)getNumbersForNews:(BOOL)         


        
6条回答
  •  孤城傲影
    2020-12-13 06:03

    A BOOL is not an object - it's a synonym for an int and has 0 or 1 as its values. As a result, it's not going to be put in an object-containing structure.

    You can use NSNumber to create an object wrapper for any of the integer types; there's a constructor [NSNumber numberWithBool:] that you can invoke to get an object, and then use that. Similarly, you can use that to get the object back again: [obj boolValue].

提交回复
热议问题