Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextField Chinese character moves down when editing in iOS 10

The environment that I'm using is Xcode8 and iOS10 .

What did i do:
In IB , drag an UITextField into my main view ,add some constraints to place the textfield in the right place , select the textfield's border style to none, at last, type some text to make the UITextField resize in storyboard ,like below: TextField in storyboard

In order to see what's going on , i also make the textfield to draw its boundary by adding this in viewDidLoad: self.textField.layer.borderWidth = 1;

Build and run , it looks good on device:

enter image description here

The Problem

However,if i try to edit the textfield (when the textfield becomes first responder) , the text moves down :

enter image description here

This issue occurs only when setting the Textfield's border style to none and the text contains Chinese characters , does anyone has a clue of what's happening here ?

like image 213
Gocy015 Avatar asked Jan 05 '23 08:01

Gocy015


1 Answers

I fix this issue by setting the borderStyle to anything but UITextBorderStyleNone in the interface builder , and then in my vc's viewDidLoad , change it to UITextBorderStyleNone , i suppose that this is just another one of many bugs that the interface builder has ? :)

like image 200
Gocy015 Avatar answered Feb 10 '23 07:02

Gocy015