我知道如何按位與工作,但我不明白(sourceDragMask & NSDragOperationGeneric)在這裏工作,我不明白這一點。是否有人可以向我解釋?非常感謝。這個「&」在這個陳述中是如何工作的?
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard;
NSDragOperation sourceDragMask;
sourceDragMask = [sender draggingSourceOperationMask];
pboard = [sender draggingPasteboard];
if ([[pboard types] containsObject:NSColorPboardType])
{
if (sourceDragMask & NSDragOperationGeneric)
{
return NSDragOperationGeneric;
}
}
return NSDragOperationNone;
}