iOS10 UITextField输入中文时文字会下沉,输入英文则是正确的,不会有任何影响。输入完闭丢失焦点后位置回到正确的位置。真机和模拟器效果一样。
字体是14号字,textfield是30的高,应该能容纳下当前的字体
这是我的截图:
以下是我所有的代码:
import UIKit
class ViewController: UIViewController,UITextFieldDelegate{
@IBOutlet weak var textField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
self.view.endEditing(true);
}
}
这是我的storyboard设置截图:
天蓬老师2017-04-18 09:44:54
I also encountered this problem. It was fine before iOS10. This problem will occur if the border is set to None for the textfield created with xib. This problem will not occur if the border is set to default. My solution is: set it to have borders by default in xib, and then set it to borderless in code. It's probably a problem with iOS10. Pure code creation is probably no problem either.
伊谢尔伦2017-04-18 09:44:54
Maybe it’s an ios10 bug! I also found out, there is nothing I can do about it.
PHP中文网2017-04-18 09:44:54
iOS 10’s own problems, let’s see if there are any fixes in today’s 10.1.