目前,我正在尝试Apportable入门套件。并且UITextField
似乎无法正常使用非英语键盘。我想知道如何启用非英语键盘。
设备中的Android OS(4.x)(Samsung Galaxy S2)以韩语模式运行,并且在系统设置应用程序中安装并启用了韩语键盘。键盘在其他应用程序中运行良好。但是在Apportable构建的应用程序中,它不起作用。将语言模式更改为韩语后,仍然输入英文字符而不是韩文字符组合。
以下是按ㅎ
键时发生的情况。 g
代替ㅎ
字符。在英文键盘中,g
位于ㅎ
键所在的位置。
更新
我进一步调查了这一点,并发现了这些观点。
使用某些设备测试结果。
我无法使用最近的设备进行测试,因为我没有。
此问题仅在相同键盘软件的qwerty模式下发生。相同键盘软件的另一种输入模式效果很好。
从Android电子市场安装的Google qwerty键盘应用效果很好。
我认为这是针对特定版本的三星软件的错误......
以下是重现此问题的AppDelegate.m
文件的完整源代码。只需创建一个新项目,复制并粘贴即可。然后你会看到问题。您的Android操作系统需要设置为韩语模式,并且还需要启用韩语键盘。我认为这可以用另一种需要动态组合的日语或中文语言键盘进行测试。
#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