我把它缩小到只有IOS6设备.
原始问题:
我到处搜索并尝试了一切,我根本想不出来!
我有一个UITextField.选中后,键盘向上滑动,光标在文本字段上开始闪烁.当我点击键盘上的按钮时,一切都正常,键响应,光标停止闪烁.唯一的问题是文本没有放入文本字段!然而,它接受来自表情符号键盘的输入.任何帮助将非常感谢!
这是如何UITextField创建的:
UITextField *userInput = [[UITextField alloc] initWithFrame:CGRectMake(10, yPos, controlWidth, 26)];
yPos += 32;
[userInput setText:[prompt defaultValue]];
[userInput setPlaceholder:[prompt helpText]];
[userInput setBorderStyle:UITextBorderStyleRoundedRect];
[userInput setClearButtonMode:UITextFieldViewModeWhileEditing];
[userInput setFont:[UIFont fontWithName:@"Helvetica" size:18]];
[userInput setAdjustsFontSizeToFitWidth:YES];
[userInput setMinimumFontSize:10];
[userInput setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[userInput setDelegate:self];
[self.scrollView addSubview:userInput];
[self.promptControls addObject:userInput];
[userInput release];
Run Code Online (Sandbox Code Playgroud)
这是一个for循环所以UITextFields 的数量取决于循环被调用的次数.
这些是我使用的委托方法:
- (void)textFieldDidBeginEditing:(UITextField *)aTextField
{
self.activeField = aTextField;
}
- (void)textFieldDidEndEditing:(UITextField *)aTextField
{
self.activeField = nil;
}
- (BOOL)textFieldShouldReturn:(UITextField *)aTextField
{
[aTextField resignFirstResponder];
return YES;
}
Run Code Online (Sandbox Code Playgroud)
activeField …