Skip to content

Commit fa114c4

Browse files
authored
fix issue: TextField can not receive characters(non number or english… (#20209)
1 parent 5a9a517 commit fa114c4

File tree

9 files changed

+376
-519
lines changed

9 files changed

+376
-519
lines changed

build/cocos2d_libs.xcodeproj/project.pbxproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,7 @@
12861286
43015DC01B60DF4000E75161 /* CCComExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */; };
12871287
43015DC11B60DF4000E75161 /* CCComExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */; };
12881288
43015DC21B60DF4000E75161 /* CCComExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */; };
1289+
4621ED182359A92200E5C937 /* CCInputView-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4621ED172359A92200E5C937 /* CCInputView-ios.mm */; };
12891290
46270FA41E1CC6A200AAA098 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46270FA21E1CC6A100AAA098 /* libcrypto.a */; };
12901291
46270FA51E1CC6A200AAA098 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46270FA31E1CC6A100AAA098 /* libssl.a */; };
12911292
46270FA81E1CC84500AAA098 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46270FA61E1CC84500AAA098 /* libcrypto.a */; };
@@ -5052,6 +5053,8 @@
50525053
3EACC99F19F5014D00EB3C5E /* CCLight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLight.h; sourceTree = "<group>"; };
50535054
43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCComExtensionData.cpp; sourceTree = "<group>"; };
50545055
43015DBE1B60DF4000E75161 /* CCComExtensionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCComExtensionData.h; sourceTree = "<group>"; };
5056+
4621ED172359A92200E5C937 /* CCInputView-ios.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "CCInputView-ios.mm"; sourceTree = "<group>"; };
5057+
4621ED192359A94700E5C937 /* CCInputView-ios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CCInputView-ios.h"; sourceTree = "<group>"; };
50555058
46270FA21E1CC6A100AAA098 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = ../external/openssl/prebuilt/mac/libcrypto.a; sourceTree = "<group>"; };
50565059
46270FA31E1CC6A100AAA098 /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = ../external/openssl/prebuilt/mac/libssl.a; sourceTree = "<group>"; };
50575060
46270FA61E1CC84500AAA098 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = ../external/openssl/prebuilt/ios/libcrypto.a; sourceTree = "<group>"; };
@@ -8107,6 +8110,8 @@
81078110
503DD8DD1926736A00CD74DD /* CCPlatformDefine-ios.h */,
81088111
503DD8DE1926736A00CD74DD /* CCStdC-ios.h */,
81098112
503DD8DF1926736A00CD74DD /* OpenGL_Internal-ios.h */,
8113+
4621ED172359A92200E5C937 /* CCInputView-ios.mm */,
8114+
4621ED192359A94700E5C937 /* CCInputView-ios.h */,
81108115
);
81118116
path = ios;
81128117
sourceTree = "<group>";
@@ -11579,6 +11584,7 @@
1157911584
developmentRegion = English;
1158011585
hasScannedForEncodings = 0;
1158111586
knownRegions = (
11587+
English,
1158211588
en,
1158311589
);
1158411590
mainGroup = 1551A334158F2AB200E66CFE;
@@ -13561,6 +13567,7 @@
1356113567
5020A1F91D49912500E80C72 /* SkeletonJson.c in Sources */,
1356213568
50ABBEBC1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
1356313569
50ABBE721925AB6F00A911A9 /* CCEventListenerMouse.cpp in Sources */,
13570+
4621ED182359A92200E5C937 /* CCInputView-ios.mm in Sources */,
1356413571
B665E41B1AA80A6600DDB1C5 /* CCPUTextureRotator.cpp in Sources */,
1356513572
B665E2971AA80A6500DDB1C5 /* CCPUEmitterManager.cpp in Sources */,
1356613573
50ABC0001926664800A911A9 /* CCFileUtils-apple.mm in Sources */,

cocos/platform/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ elseif(APPLE)
9595
platform/ios/CCEAGLView-ios.h
9696
platform/ios/CCGLViewImpl-ios.h
9797
platform/ios/CCES2Renderer-ios.h
98+
platform/ios/CCInputView-ios.h
9899
)
99100
set(COCOS_PLATFORM_SPECIFIC_SRC
100101
${COCOS_PLATFORM_SPECIFIC_SRC}
@@ -106,6 +107,7 @@ elseif(APPLE)
106107
platform/ios/CCES2Renderer-ios.m
107108
platform/ios/CCGLViewImpl-ios.mm
108109
platform/ios/CCImage-ios.mm
110+
platform/ios/CCInputView-ios.mm
109111
)
110112
endif()
111113

cocos/platform/ios/CCEAGLView-ios.h

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6060
Copyright (C) 2008 Apple Inc. All Rights Reserved.
6161
6262
*/
63-
64-
#include "platform/CCPlatformConfig.h"
65-
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
66-
6763
#import <UIKit/UIKit.h>
6864
#import <OpenGLES/EAGL.h>
6965
#import <OpenGLES/EAGLDrawable.h>
@@ -80,42 +76,18 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
8076
* The view content is basically an EAGL surface you render your OpenGL scene into.
8177
* Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
8278
*/
83-
@interface CCEAGLView : UIView <UIKeyInput, UITextInput, UITextInputTraits>
79+
@interface CCEAGLView : UIView
8480
{
8581
id<CCESRenderer> renderer_;
86-
EAGLContext *context_; // weak ref
8782

88-
NSString *pixelformat_;
89-
GLuint depthFormat_;
9083
BOOL preserveBackbuffer_;
91-
92-
CGSize size_;
9384
CGRect safeArea_;
9485
BOOL discardFramebufferSupported_;
9586

9687
//fsaa addition
97-
BOOL multisampling_;
9888
unsigned int requestedSamples_;
99-
BOOL isUseUITextField;
100-
@private
101-
NSString * markedText_;
102-
CGRect caretRect_;
103-
CGRect originalRect_;
104-
NSNotification* keyboardShowNotification_;
105-
BOOL isKeyboardShown_;
10689
}
10790

108-
@property(nonatomic, readonly) UITextPosition *beginningOfDocument;
109-
@property(nonatomic, readonly) UITextPosition *endOfDocument;
110-
@property(nonatomic, assign) id<UITextInputDelegate> inputDelegate;
111-
@property(nonatomic, readonly) UITextRange *markedTextRange;
112-
@property (nonatomic, copy) NSDictionary *markedTextStyle;
113-
@property(readwrite, copy) UITextRange *selectedTextRange;
114-
@property(nonatomic, readonly) id<UITextInputTokenizer> tokenizer;
115-
@property(nonatomic, readonly, getter = isKeyboardShown) BOOL isKeyboardShown;
116-
@property(nonatomic, copy) NSNotification* keyboardShowNotification;
117-
@property(nonatomic) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault
118-
11991
/** creates an initializes an CCEAGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
12092
+ (id) viewWithFrame:(CGRect)frame;
12193
/** creates an initializes an CCEAGLView with a frame, a color buffer format, and 0-bit depth buffer */
@@ -132,7 +104,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
132104
/** Initializes an CCEAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling support */
133105
- (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)sampling numberOfSamples:(unsigned int)nSamples;
134106

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

158130
-(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis;
159131
-(void) doAnimationWhenAnotherEditBeClicked;
160-
@end
161132

162-
#endif // CC_PLATFORM_IOS
133+
- (void) showKeyboard;
134+
- (void) hideKeyboard;
135+
@end

0 commit comments

Comments
 (0)