Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue that can not receive Chinese characters with system input m… #20232

Merged
merged 2 commits into from
Oct 24, 2019
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
2 changes: 1 addition & 1 deletion cocos/platform/ios/CCInputView-ios.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#import <UIKit/UIKit.h>

@interface CCInputView : UIView <UIKeyInput>
@interface CCInputView : UIView <UITextInput>
@end
25 changes: 20 additions & 5 deletions cocos/platform/ios/CCInputView-ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@ @implementation CCInputView
@synthesize myMarkedText;
@synthesize isKeyboardShown;

@synthesize hasText;
@synthesize selectedTextRange;
@synthesize beginningOfDocument;
@synthesize endOfDocument;
@synthesize markedTextStyle;
@synthesize tokenizer;
@synthesize autocorrectionType;

- (instancetype) initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame] ) {
self.myMarkedText = nil;
self.autocorrectionType = UITextAutocorrectionTypeNo;
}

return self;
Expand All @@ -35,14 +44,14 @@ - (void)didMoveToWindow
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onUIKeyboardNotification:)
name:UIKeyboardWillShowNotification object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onUIKeyboardNotification:)
name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onUIKeyboardNotification:)
name:UIKeyboardWillHideNotification object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onUIKeyboardNotification:)
name:UIKeyboardDidHideNotification object:nil];
Expand All @@ -62,6 +71,14 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event

#pragma TextInput protocol

- (id<UITextInputDelegate>)inputDelegate {
return nil;
}

- (void)setInputDelegate:(id<UITextInputDelegate>)inputDelegate {

}

- (void)deleteBackward {
if (nil != self.myMarkedText) {
[self.myMarkedText release];
Expand Down Expand Up @@ -178,7 +195,7 @@ - (nullable NSString *)textInRange:(nonnull UITextRange *)range {
if (nil != self.myMarkedText) {
return self.myMarkedText;
}
return nil;
return @"";
}

- (nullable UITextRange *)textRangeFromPosition:(nonnull UITextPosition *)fromPosition toPosition:(nonnull UITextPosition *)toPosition {
Expand Down Expand Up @@ -327,6 +344,4 @@ - (void)onUIKeyboardNotification:(NSNotification *)notif
}
}

@synthesize hasText;

@end