objective-c - iOS10 textfield 输入中文时文字会下沉
巴扎黑
巴扎黑 2017-04-18 09:42:54
0
5
622

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, with event: UIEvent?) { self.view.endEditing(true); } }

这是我的storyboard设置截图:

巴扎黑
巴扎黑

reply all (5)
Peter_Zhu

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.

    伊谢尔伦

    Maybe it’s an ios10 bug! I also found out, there is nothing I can do about it.

      洪涛

      iOS 10’s own problems, let’s see if there are any fixes in today’s 10.1.

        PHPzhong

        Try using textView

          大家讲道理

          http://stackoverflow.com/ques...

            Latest Downloads
            More>
            Web Effects
            Website Source Code
            Website Materials
            Front End Template
            About us Disclaimer Sitemap
            php.cn:Public welfare online PHP training,Help PHP learners grow quickly!