UIKeyboard第一个字符在模拟器中是大写但在设备中不是大写?
我正在创建 ViewBased 项目,就在 ViewController 的 ViewDidLoad 中,我正在编写以下代码
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
UITextField *name_textField = [[UITextField alloc] initWithFrame:CGRectMake(110, 21, 200, 30)];
name_textField.delegate=self;
name_textField.keyboardType = UIKeyboardTypeASCIICapable;
name_textField.autocorrectionType = UITextAutocorrectionTypeNo;
[name_textField setBorderStyle:UITextBorderStyleRoundedRect];
[name_textField resignFirstResponder];
[self.view addSubview:name_textField];
[super viewDidLoad];
}
当我在模拟器上运行时,它将在文本字段中显示第一个字符大写,并且按下 Shift 键,但当我在设备(iPod Touch 4g)上运行它时,iOS 5),它没有做任何大写。
这是一种奇怪的行为,有人可以告诉我原因以及如何解决吗?
I am creating ViewBased Project, Just in ViewController's ViewDidLoad, I am writting the following code
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
UITextField *name_textField = [[UITextField alloc] initWithFrame:CGRectMake(110, 21, 200, 30)];
name_textField.delegate=self;
name_textField.keyboardType = UIKeyboardTypeASCIICapable;
name_textField.autocorrectionType = UITextAutocorrectionTypeNo;
[name_textField setBorderStyle:UITextBorderStyleRoundedRect];
[name_textField resignFirstResponder];
[self.view addSubview:name_textField];
[super viewDidLoad];
}
As I do run on simulator, it will show first character capital in textField and also shift key is press, but as I run it on device (iPod Touch 4g, iOS 5), it is not doing any capitalization.
It is strange behavior, can any one tell me reasons and how to solve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试在初始化后添加:
Try to add this after initialization:
该设备上的“自动大写”选项很可能已关闭。您可以在“设置”>“设置”中找到该选项。一般>键盘。
It's very likely that the "Auto-Capitalization" option is turned off on that device. You can find that option in Settings > General > Keyboard.