iOS introduced keyboard splitting/undock from iOS 5, and it may hang the keyboard in the current cocos2dx engine
Below is steps of reproducing the bug:
- Open TestCpp project in samples
- Choose the text input test
- Click the input field, till now, everything is fine
- Split the keyboard by swiping the keyboard apart with two fingers
- Now the keyboard hangs and it won’t take user interations. If keyboard is still active, repeat step 4, and finally it will hang!
I found the bug on iPad 3 and iPad mini with iOS 5 and iOS 6, but not able to fix it. I’m not very familiar with iOS infrastructures.
Several links mentioned similiar issues like the below one, but still I don’t know how to fix it:
Any suggestions how to fix it, guys?
will anybody take a look at this bug, or at least give me a reply, please?
neno
#3
I do not know how to help you but I’ve created an issue on github: https://github.com/cocos2d/cocos2d-x/issues/2545
cooado
#4
thx, hopes it get fixed soon
cooado
#6
NO, the developer team seems not interested in this bug and leaves it totally to us, but i haven’t been able to find a solution yet
xiaofei yu wrote:
NO, the developer team seems not interested in this bug and leaves it totally to us, but i haven’t been able to find a solution yet
Had the same issue - the solution is to stop the opengl layer from rendering while this is happening. Here’s what I did:
- Register for keyboard frame change events at start of application. I did this in AppController.mm
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ... [[NSNotificationCenter defaultCenter] addObserver:self selector:
selector(keyboardWillChangeFrame:)
name:UIKeyboardWillChangeFrameNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:selector(keyboardDidChangeFrame:) name:UIKeyboardDidChangeFrameNotification object:nil]; ... }
- Started and stopped rendering during keyboard animation.
- (void)keyboardWillChangeFrame:(NSNotification *)notification {
// stop openGL animation while animating keyboard
cocos2d::CCDirector::sharedDirector()~~>stopAnimation;
}
~~ (void)keyboardDidChangeFrame:(NSNotification *)notification {
// restart openGL animation when keyboard stops animating
cocos2d::CCDirector::sharedDirector()->startAnimation();
}
cooado
#8
yes, it works, thanks @Winston She