- CGSize is a C struct
[self keyboardSize:notification]
may return nil
When declaring a C struct, its values have garbage values. That is, whatever was in that piece of memory before. If your call to keyboardSize
returns an uninitialized CGSize
, that C struct will have what's called "garbage value".
Now that I see your implementation of CGSize, change the declaration of the variable keyboardSize in your keyboardSize
method to:
CGSize keyboardSize = CGSizeMake(0, 0);