Skip to content

Commit

Permalink
fix issue: TextField can not receive characters(non number or english… (
Browse files Browse the repository at this point in the history
  • Loading branch information
minggo committed Oct 24, 2019
1 parent 5a9a517 commit fa114c4
Show file tree
Hide file tree
Showing 9 changed files with 376 additions and 519 deletions.
7 changes: 7 additions & 0 deletions build/cocos2d_libs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,7 @@
43015DC01B60DF4000E75161 /* CCComExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */; };
43015DC11B60DF4000E75161 /* CCComExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */; };
43015DC21B60DF4000E75161 /* CCComExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */; };
4621ED182359A92200E5C937 /* CCInputView-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4621ED172359A92200E5C937 /* CCInputView-ios.mm */; };
46270FA41E1CC6A200AAA098 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46270FA21E1CC6A100AAA098 /* libcrypto.a */; };
46270FA51E1CC6A200AAA098 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46270FA31E1CC6A100AAA098 /* libssl.a */; };
46270FA81E1CC84500AAA098 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46270FA61E1CC84500AAA098 /* libcrypto.a */; };
Expand Down Expand Up @@ -5052,6 +5053,8 @@
3EACC99F19F5014D00EB3C5E /* CCLight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLight.h; sourceTree = "<group>"; };
43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCComExtensionData.cpp; sourceTree = "<group>"; };
43015DBE1B60DF4000E75161 /* CCComExtensionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCComExtensionData.h; sourceTree = "<group>"; };
4621ED172359A92200E5C937 /* CCInputView-ios.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "CCInputView-ios.mm"; sourceTree = "<group>"; };
4621ED192359A94700E5C937 /* CCInputView-ios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CCInputView-ios.h"; sourceTree = "<group>"; };
46270FA21E1CC6A100AAA098 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = ../external/openssl/prebuilt/mac/libcrypto.a; sourceTree = "<group>"; };
46270FA31E1CC6A100AAA098 /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = ../external/openssl/prebuilt/mac/libssl.a; sourceTree = "<group>"; };
46270FA61E1CC84500AAA098 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = ../external/openssl/prebuilt/ios/libcrypto.a; sourceTree = "<group>"; };
Expand Down Expand Up @@ -8107,6 +8110,8 @@
503DD8DD1926736A00CD74DD /* CCPlatformDefine-ios.h */,
503DD8DE1926736A00CD74DD /* CCStdC-ios.h */,
503DD8DF1926736A00CD74DD /* OpenGL_Internal-ios.h */,
4621ED172359A92200E5C937 /* CCInputView-ios.mm */,
4621ED192359A94700E5C937 /* CCInputView-ios.h */,
);
path = ios;
sourceTree = "<group>";
Expand Down Expand Up @@ -11579,6 +11584,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 1551A334158F2AB200E66CFE;
Expand Down Expand Up @@ -13561,6 +13567,7 @@
5020A1F91D49912500E80C72 /* SkeletonJson.c in Sources */,
50ABBEBC1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
50ABBE721925AB6F00A911A9 /* CCEventListenerMouse.cpp in Sources */,
4621ED182359A92200E5C937 /* CCInputView-ios.mm in Sources */,
B665E41B1AA80A6600DDB1C5 /* CCPUTextureRotator.cpp in Sources */,
B665E2971AA80A6500DDB1C5 /* CCPUEmitterManager.cpp in Sources */,
50ABC0001926664800A911A9 /* CCFileUtils-apple.mm in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions cocos/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ elseif(APPLE)
platform/ios/CCEAGLView-ios.h
platform/ios/CCGLViewImpl-ios.h
platform/ios/CCES2Renderer-ios.h
platform/ios/CCInputView-ios.h
)
set(COCOS_PLATFORM_SPECIFIC_SRC
${COCOS_PLATFORM_SPECIFIC_SRC}
Expand All @@ -106,6 +107,7 @@ elseif(APPLE)
platform/ios/CCES2Renderer-ios.m
platform/ios/CCGLViewImpl-ios.mm
platform/ios/CCImage-ios.mm
platform/ios/CCInputView-ios.mm
)
endif()

Expand Down
37 changes: 5 additions & 32 deletions cocos/platform/ios/CCEAGLView-ios.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2008 Apple Inc. All Rights Reserved.
*/

#include "platform/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS

#import <UIKit/UIKit.h>
#import <OpenGLES/EAGL.h>
#import <OpenGLES/EAGLDrawable.h>
Expand All @@ -80,42 +76,18 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
* The view content is basically an EAGL surface you render your OpenGL scene into.
* Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
*/
@interface CCEAGLView : UIView <UIKeyInput, UITextInput, UITextInputTraits>
@interface CCEAGLView : UIView
{
id<CCESRenderer> renderer_;
EAGLContext *context_; // weak ref

NSString *pixelformat_;
GLuint depthFormat_;
BOOL preserveBackbuffer_;

CGSize size_;
CGRect safeArea_;
BOOL discardFramebufferSupported_;

//fsaa addition
BOOL multisampling_;
unsigned int requestedSamples_;
BOOL isUseUITextField;
@private
NSString * markedText_;
CGRect caretRect_;
CGRect originalRect_;
NSNotification* keyboardShowNotification_;
BOOL isKeyboardShown_;
}

@property(nonatomic, readonly) UITextPosition *beginningOfDocument;
@property(nonatomic, readonly) UITextPosition *endOfDocument;
@property(nonatomic, assign) id<UITextInputDelegate> inputDelegate;
@property(nonatomic, readonly) UITextRange *markedTextRange;
@property (nonatomic, copy) NSDictionary *markedTextStyle;
@property(readwrite, copy) UITextRange *selectedTextRange;
@property(nonatomic, readonly) id<UITextInputTokenizer> tokenizer;
@property(nonatomic, readonly, getter = isKeyboardShown) BOOL isKeyboardShown;
@property(nonatomic, copy) NSNotification* keyboardShowNotification;
@property(nonatomic) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault

/** creates an initializes an CCEAGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
+ (id) viewWithFrame:(CGRect)frame;
/** creates an initializes an CCEAGLView with a frame, a color buffer format, and 0-bit depth buffer */
Expand All @@ -132,7 +104,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
/** Initializes an CCEAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling support */
- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)sampling numberOfSamples:(unsigned int)nSamples;

/** pixel format: it could be RGBA8 (32-bit) or RGB565 (16-bit) */
//// * pixel format: it could be RGBA8 (32-bit) or RGB565 (16-bit)
@property(nonatomic,readonly) NSString* pixelFormat;
/** depth format of the render buffer: 0, 16 or 24 bits*/
@property(nonatomic,readonly) GLuint depthFormat;
Expand All @@ -157,6 +129,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.

-(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis;
-(void) doAnimationWhenAnotherEditBeClicked;
@end

#endif // CC_PLATFORM_IOS
- (void) showKeyboard;
- (void) hideKeyboard;
@end
Loading

0 comments on commit fa114c4

Please sign in to comment.