【发布时间】:2016-11-25 19:40:46
【问题描述】:
我想在UITextField结束编辑后添加一些字符串。
例子:
文本字段 1 :用户输入 1000 。聚焦到 textfield2 后,我想在 textfield1 中添加“英里”。 => textfield1 : 1000 英里
如果用户再次关注 textfield1,它只显示 1000 供用户编辑,没有“英里”。
试过了还是不行
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event
{
UITouch *touch = [[event allTouches] anyObject];
if ([textfield1 isFirstResponder] && (textfield1 != touch.view))
{
textfield1.text = [NSString stringWithFormat:@"miles"];
}
if ([textfield2 isFirstResponder] && (textfield2 != touch.view))
{
....
}
}
【问题讨论】:
标签: ios objective-c uitextfield