ios - BOOL vs. bool on iOS7 -
in ios came across problem bool vs. bool.
i know 1 bitfield , other integer.
however following code behaves differently on ios7 , ios8:
self.nativationitem.rightbarbutton = _editbutton; //where editbutton uibarbuttonitem. _editbutton.enabled = _some_nsarray.count;
since count defined nsuinteger
, expect 0 (false) or true other value > 0.
however, on ios7 when _some_nsarray.count > 0, editbutton disabled on ios8 editbutton enabled! exact same code.
another thing if cast _some_nsarray.count "bool" (not capital letters), works on both if cast (bool) works on 8 not 7.
any ideas?
enabled
bool
. count
nsuinteger
. proper code be:
_editbutton.enabled = _some_nsarray.count > 0;
bool
should assigned yes
or no
values (or equivalent result of conditional expression).
Comments
Post a Comment