How to enable international keyboard support in Apportable?

旧巷老猫 提交于 2019-12-10 20:30:38

问题


Currently, I am trying Apportable starter kit. And UITextField doesn't seem to work properly with non-English keyboard. I want to know how to enable the non-English keyboard.

Android OS (4.x) in the device(Samsung Galaxy S2) is running in Korean language mode, and also Korean keyboard is installed and enabled in system settings app. The keyboard is working well in other apps. But in apps built by Apportable, it doesn't work. After I changed language mode to Korean, it still input English character instead of Korean character composition.

Here's what happening when I press key. g is placed instead of character. In English keyboard, g was at the same position where the key is.

Update

I investigated this further, and discovered these points.

  1. Test results with some devices.

    • Samsung Galaxy Gio (factory default Gingerbread) : Works well. No issue.
    • Samsung Galaxy S Hoppin (factory default Gingerbread) : Works well. No issue.
    • Samsung Galaxy S2 HD LTE (updated to Jelly Bean, 4.1.2) : Doesn't work. Same issue.
    • Samsung Galaxy S2 (updated to Jelly Bean 4.1.2) : Doesn't work. Same issue.

I couldn't test with recent devices because I don't have one.

  1. This issue happens only in qwerty mode of the same keyboard software. Another input modes of the same keyboard software works well.

  2. Google qwerty keyboard app installed from Android Market works well.

I think this is a bug of Samsung software only for specific version...

Reproduction

Here's full source code for AppDelegate.m file to reproduce this issue. Just create a new project, copy and paste. Then you will see the problem. Your Android OS need to be set to Korean mode and also Korean keyboard need to be enabled. I think this can be tested with another language keyboard like Japanese or Chinese which needs dynamic composition.


#import "AAAppDelegate.h"


@interface  TesterView : UIView
@end


@implementation AAAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];


    UINavigationController* nc  =   [[UINavigationController alloc] init];

    UITableViewController*  tvc =   [[UITableViewController alloc] init];
    tvc.navigationItem.title    =   [NSString stringWithCString:"TT한글TT" encoding:NSUTF8StringEncoding];
    tvc.navigationItem.leftBarButtonItem        =   [[UIBarButtonItem alloc] initWithTitle:@"WDWD" style:(UIBarButtonItemStyleDone) target:nil action:nil];
    tvc.navigationItem.rightBarButtonItem   =   [[UIBarButtonItem alloc] initWithTitle:@"@E###@@#" style:(UIBarButtonItemStyleBordered) target:self action:@selector(test1:)];
    [nc pushViewController:tvc animated:NO];
    [self.window setRootViewController:nc];

    return YES;
}
- (void)test1:(id)sender
{
        UILabel*    lbl =   [[UILabel alloc] init];
        lbl.text    =   @"DWDWDWD";
        [lbl setFrame:CGRectMake(0, 0, 100, 100)];
        [lbl setTextColor:[UIColor blackColor]];
        [lbl setBackgroundColor:[UIColor grayColor]];

        UITextField*    txt =   [[UITextField alloc] init];
        txt.text    =   [NSString stringWithCString:"This is UITextField. I am trying to write some Korean characters (한글)." encoding:NSUTF8StringEncoding];
        [txt setFrame:CGRectMake(50, 50, 200, 100)];
        [txt setTextColor:[UIColor whiteColor]];
        [txt setBackgroundColor:[[UIColor blackColor] colorWithAlphaComponent:0.5f]];

        UIScrollView*   sv  =   [[UIScrollView alloc] init];
        [sv setFrame:CGRectMake(0, 100, 320, 100)];
        [sv setBackgroundColor:[[UIColor blueColor] colorWithAlphaComponent:0.5f]];

        UITextView*     txtv    =   [[UITextView alloc] init];
        [txtv setFrame:CGRectMake(100, 0, 100, 100)];
        [txtv setBackgroundColor:[[UIColor greenColor] colorWithAlphaComponent:0.5f]];
        [sv addSubview:txtv];       //  BUG: adding subview on UIScrollView doesn't work. Also UIScrollView scrolling doesn't seem to work.

        UIViewController*   vc  =   [[UIViewController alloc] init];
        vc.view =   [[TesterView alloc] init];
        [vc.view addSubview:lbl];
        [vc.view addSubview:txt];
        [vc.view addSubview:sv];
        [vc.view setBackgroundColor:[UIColor redColor]];
        [sv setContentSize:CGSizeMake(400, 0)];

        UINavigationController* nc  =   (id)self.window.rootViewController;
        [nc pushViewController:vc animated:YES];
}

@end


@implementation TesterView
//- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
//{
//  [super touchesBegan:touches withEvent:event];
//}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesMoved:touches withEvent:event];
    NSLog(@"touches = %@, event = %@", touches, event);

    UITouch*    t   =   touches.anyObject;
    CGPoint     p   =   [t locationInView:self];

    [self.subviews[0] setFrame:CGRectMake(p.x, p.y, 100, 100)];
}
@end

来源:https://stackoverflow.com/questions/17228792/how-to-enable-international-keyboard-support-in-apportable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!