Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cocos/platform/ios/CCEAGLView-ios.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 6 additions & 3 deletions cocos/platform/ios/CCEAGLView-ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -466,6 +464,11 @@ - (void) hideKeyboard
[self.textInputView removeFromSuperview];
}

-(BOOL) isKeyboardShown
{
return [self.textInputView isKeyboardShown];
}

-(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis
{

Expand Down
1 change: 1 addition & 0 deletions cocos/platform/ios/CCInputView-ios.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import <UIKit/UIKit.h>

@interface CCInputView : UIView <UITextInput>
@property(nonatomic) BOOL isKeyboardShown;
@end
3 changes: 2 additions & 1 deletion cocos/platform/ios/CCInputView-ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@interface CCInputView ()

@property(nonatomic) NSString* myMarkedText;
@property(nonatomic) BOOL isKeyboardShown;

@end

Expand Down Expand Up @@ -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)
Expand All @@ -340,6 +340,7 @@ - (void)onUIKeyboardNotification:(NSNotification *)notif
}
else if (UIKeyboardDidHideNotification == type)
{
self.isKeyboardShown = NO;
dispatcher->dispatchKeyboardDidHide(notiInfo);
}
}
Expand Down