Note that there are some explanatory texts on larger screens.

plurals
  1. POUIKeyInput is not called when using Japanese keyboard
    text
    copied!<p>I have a class which inherits from <strong>UIView</strong> and conforms to <strong>UIKeyInput</strong> *<em>.h</em>*</p> <pre><code>@interface UIKeyInputExampleView : UIView &lt;UIKeyInput&gt;{ NSMutableString *textStore; } @property (nonatomic, retain) NSMutableString *textStore; @end </code></pre> <p><strong>.m</strong></p> <pre><code>@implementation UIKeyInputExampleView @synthesize textStore; - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { // Initialization code self.textStore = [NSMutableString string]; [self.textStore appendString:@"Touch screen to edit."]; self.backgroundColor = [UIColor whiteColor]; } return self; } - (void)dealloc { [textStore dealloc]; [super dealloc]; } #pragma mark - #pragma mark Respond to touch and become first responder. - (BOOL)canBecomeFirstResponder { return YES; } -(void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event { [self becomeFirstResponder]; } #pragma mark - #pragma mark Drawing - (void)drawRect:(CGRect)rect { CGRect rectForText = CGRectInset(rect, 20.0, 20.0); UIRectFrame(rect); [self.textStore drawInRect:rectForText withFont:[UIFont fontWithName:@"Helvetica" size:24.0f]]; } #pragma mark - #pragma mark UIKeyInput Protocol Methods - (BOOL)hasText { if (textStore.length &gt; 0) { return YES; } return NO; } - (void)insertText:(NSString *)theText { NSLog(@"Text have just enter:%@ length=%d ascii=%d",theText,theText.length,[theText characterAtIndex:0]); if ([theText isEqualToString:@"\n"]) { NSLog(@"Enter have just pressed!"); [self resignFirstResponder]; } self.textStore = (NSMutableString*)theText; [self setNeedsDisplay]; } - (void)deleteBackward { self.textStore = (NSMutableString*)@"delete"; [self setNeedsDisplay]; } @end </code></pre> <p>When I use the English or Vietnamese keyboard, everything is right. but when I use <strong>Japanese</strong> keyboard, <strong>no event</strong> is called, <strong>no exception</strong> is thrown. I think I have not conformed some protocol</p> <p>Can you help me?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload