Frequently used symbol “|” in Objective-C

前端 未结 4 1296
清歌不尽
清歌不尽 2020-12-11 10:11
self.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleWidth;

The source code is shown above. Wonder what the symbol \"|

4条回答
  •  醉话见心
    2020-12-11 10:37

    The | character denotes an inclusive-or bitwise operation. which operates under the premise with matching the bitstrings of two objects.

    if you have a bitstring 1101 and another 1001 the inclusive or of the two would produce 1011. Basically if the current bit is the same in both strings then a 1 is outputted in its place otherwise a 0 is.

提交回复
热议问题