Why can I use the bitwise operation of the enumeration?
1. What is a bitwise operation in an enumeration?
For example
int a = 1 << 0; 1 shift left 0-bit 1*2^0 = 1;
int b = 1 << 1; 1 shift left 1-bit 1*2^1 = 2;
int c = 1 << 2; 1 shift left 2-bit 1*2^2 = 4;
int d = 1 << 3; 1 shift left 3-bit 1*2^3 = 8;
and arithmetic
A | B
01
10
--------------
11 ==1+2
int value = A | b
NSLog (@ "%d,%d,%d,%d", Value & A,value & B,value & C,value & D);
The result of 0 is not included, and the result is 0 does not contain
Enumeration of events
[_TEXTF addtarget:self Action: @selector (text) Forcontrolevents:uicontroleventeditingdidbegin];
[_TEXTF addtarget:self Action: @selector (text) forcontrolevents:uicontroleventeditingchanged];
Merge the above two events as follows
[_TEXTF addtarget:self Action: @selector (text) forcontrolevents:uicontroleventeditingdidbegin | Uicontroleventeditingchanged];
}
Invoking a listener method
-(void) text
{
NSLog (@ "text box starts editing or text starts to change");
/*
Internal parsing whether the uicontroleventeditingdidbegin,uicontroleventeditingchanged is included
Step: 1.UIControlEventEditingDidBegin | Uicontroleventeditingchanged =x;
2, Judge NSLog (@ "%d", X & Uicontroleventeditingdidbegin); The result of 0 is not included, and the result is not 0 inclusive
*/
}
Bitwise operations in enumerations