DAKeyboardControl
DAKeyboardControl copied to clipboard
Selector issues
I am developing an iOS6 app and when I loaded a keyboard twice I would get unrecognized selector errors for inputKeyboardWillChangeFrame:
I commented out the method below and things started working.
// For the sake of 4.X compatibility [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(inputKeyboardWillChangeFrame:) name:@"UIKeyboardWillChangeFrameNotification" object:nil];
Ok so the issue I had was not the methods above but I wasn't calling [self.view removeKeyboardControl]; at the end of a view controller. Anyway to automate this in a future version?
Love this project :)
@nwalter08 did it fixed the issue calling [self.view removeKeyboardControl];? Because I having the same issue. In DAKeyboardControl.m on the addKeyboardControl:actionHandler: I putted a if ([self isKindOfClass:[UIView class]]){} around the notifications and it calm downs the crashes.
Yes that fixed it for me.
Dude @nwalter08 you are the man! can't believe we both had the same problem. #rookiemode
Yeah =(
I'll be looking into automating this somehow. If anyone knows of a safe way of doing this without swizzling dealloc, let me know!
I have a similar crash, yet I call the removeKeyboardControl method.
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self.view addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView) {}];
[self.aTextView addKeyboardPanningWithActionHandler:^(CGRect keyboardFrameInView) {}];
}
- (void) viewWillDisappear:(BOOL)animated {
[self.view removeKeyboardControl];
[self.aTextView removeKeyboardControl];
[super viewWillDisappear:animated];
}
There are cases where a view can become deallocated and the viewWillDisappear: method will never be called. It's best to do it in dealloc
The only case I can think of is when the app is terminated.
Otherwise, viewDidAppear: and viewWillDisappear: are always called, and will match each other.
@gcerquant it's my understanding the viewDidDisappear is more reliable than viewWillDisappear. That's where I'm calling [self.view removeKeyboardControl]; and have had no problems as of yet.
There is no more or less reliable, they are both called.
Haven't been able to look at the code (I will), but this assumption is not true.
Never mind my comments. I had an old version of DAKeyboardControl (see #35).