diff --git a/cocos/platform/ios/CCEAGLView-ios.h b/cocos/platform/ios/CCEAGLView-ios.h index b4f10e86740f..e9bc020e7084 100644 --- a/cocos/platform/ios/CCEAGLView-ios.h +++ b/cocos/platform/ios/CCEAGLView-ios.h @@ -130,6 +130,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. -(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis; -(void) doAnimationWhenAnotherEditBeClicked; -- (void) showKeyboard; -- (void) hideKeyboard; +-(void) showKeyboard; +-(void) hideKeyboard; +-(BOOL) isKeyboardShown; @end diff --git a/cocos/platform/ios/CCEAGLView-ios.mm b/cocos/platform/ios/CCEAGLView-ios.mm index 4997b851abf7..a5c0cb2a4d20 100644 --- a/cocos/platform/ios/CCEAGLView-ios.mm +++ b/cocos/platform/ios/CCEAGLView-ios.mm @@ -77,9 +77,7 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #define IOS_MAX_TOUCHES_COUNT 10 @interface CCEAGLView () -@property (nonatomic) UIView* textInputView; -- (BOOL) setupSurfaceWithSharegroup:(EAGLSharegroup*)sharegroup; -- (unsigned int) convertPixelFormat:(NSString*) pixelFormat; +@property (nonatomic) CCInputView* textInputView; @end @implementation CCEAGLView @@ -466,6 +464,11 @@ - (void) hideKeyboard [self.textInputView removeFromSuperview]; } +-(BOOL) isKeyboardShown +{ + return [self.textInputView isKeyboardShown]; +} + -(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis { diff --git a/cocos/platform/ios/CCInputView-ios.h b/cocos/platform/ios/CCInputView-ios.h index 94b69ff60580..ff60d5b94f2c 100644 --- a/cocos/platform/ios/CCInputView-ios.h +++ b/cocos/platform/ios/CCInputView-ios.h @@ -1,4 +1,5 @@ #import @interface CCInputView : UIView +@property(nonatomic) BOOL isKeyboardShown; @end diff --git a/cocos/platform/ios/CCInputView-ios.mm b/cocos/platform/ios/CCInputView-ios.mm index a788535864a0..9334d2fdb41a 100644 --- a/cocos/platform/ios/CCInputView-ios.mm +++ b/cocos/platform/ios/CCInputView-ios.mm @@ -5,7 +5,6 @@ @interface CCInputView () @property(nonatomic) NSString* myMarkedText; -@property(nonatomic) BOOL isKeyboardShown; @end @@ -332,6 +331,7 @@ - (void)onUIKeyboardNotification:(NSNotification *)notif else if (UIKeyboardDidShowNotification == type) { //CGSize screenSize = self.window.screen.bounds.size; + self.isKeyboardShown = YES; dispatcher->dispatchKeyboardDidShow(notiInfo); } else if (UIKeyboardWillHideNotification == type) @@ -340,6 +340,7 @@ - (void)onUIKeyboardNotification:(NSNotification *)notif } else if (UIKeyboardDidHideNotification == type) { + self.isKeyboardShown = NO; dispatcher->dispatchKeyboardDidHide(notiInfo); } }