tags:

views:

34

answers:

1

My code is working perfectly to reduce the size of a UITextView when the keyboard comes up. The problem is, the signature of the method is

- (void)keyboardDidShow:(NSNotification*)aNotification 

but the calling code

//[nc addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];

is commented out! I have searched low and high using grep and refactor in XCode (to see who else might be calling the method), and nothing comes up. I've checked the nibs just in case. I have tried cleaning targets, etc., but to no avail. If I rename the method, it does not get called (but this produces no errors). Any ideas as to how/where this method is being "wired?"

+1  A: 

So as it turns out, you implemented keyboardDidShow: in a UITextField subclass. However, the UITextField class itself implements this method as well, so since you've overridden it in your subclass your implementation will be getting called, instead of the UIKit one. Even though you never called it in your code, UIKit did it for you.

So that explains why your method was being called, and that renaming the method fixed the problem.

JoostK
Great answer, thanks!
Yar