What does this statement mean?
isChecked = isChecked ^ 1;
isChecked
is a BOOL
.
It only flips the last bit of BOOL
. Not a reliable way to logically negate.
If someone is crazy enough to set the a BOOL
variable to some number, for example 5. Then doing ^ 1
will only flip the last bit of the value to 4, which is still evaluated to YES
.
If you want to logically negate, use !
operator instead.