Removing event handlers

It is the same. The second is merely syntactic sugar for the first, and equality comparison is overloaded appropriately for delegate types: Two delegates of the same type with the same targets, methods, and invocation lists are considered equal. Source: MSDN, Delegate.Equality Operator

nil object in iOS8 delegate methods – custom keyboards

Good question. But it seems that UITextInputDelegate is not a protocol that you implement. From Apple Docs titled Lower Level Text-Handling Technologies: When changes occur in the text view due to external reasons—that is, they aren’t caused by calls from the text input system—the UITextInput object should send textWillChange:, textDidChange:, selectionWillChange:, and selectionDidChange: messages to …

Read more

+= operator for Delegate

It’s not an operator on the delegate type itself, in IL terms – it’s defined in the language specification, but you wouldn’t find it using reflection. The compiler turns it into a call to Delegate.Combine. The reverse operation, using – or -=, uses Delegate.Remove. At least, that’s how it’s implemented when C# targets .NET, as …

Read more