The UIRectCornerTopLeft and UIRectCornerTopRight shown in your code are actually not enumerations, but 按位掩码(bitmask), and their definition is as follows:
The syntax of a bitwise mask (NS_OPTIONS) is the same as an enumeration (NS_ENUM), but the compiler will combine its values | through a bitmask.
Editor:
For example, for the NS_OPTIONS of UIRectCorner above, according to your code, what you pass in is UIRectCornerTopLeft | UIRectCornerTopRight , then the processing code is roughly as follows:
The UIRectCornerTopLeft and UIRectCornerTopRight shown in your code are actually not enumerations, but
按位掩码(bitmask)
, and their definition is as follows:The syntax of a bitwise mask (NS_OPTIONS) is the same as an enumeration (NS_ENUM), but the compiler will combine its values
|
through a bitmask.Editor:
For example, for the NS_OPTIONS of UIRectCorner above, according to your code, what you pass in is
UIRectCornerTopLeft | UIRectCornerTopRight
, then the processing code is roughly as follows: