UITextInput仅在iOS 9中返回nil位置

时间:2016-11-07 09:55:45

标签: ios swift uitextview uitextinput uitextrange

我正在尝试获取特定范围( @Entity public class Employee { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.AUTO) private Long langId; @Column(name = "first_name") private String firstName; @Column(name = "last_name") private String lastName; @OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "id", referencedColumnName = "employee_id") private Set<Certificate> certificates; )的矩形。 问题是代码与UITextRange一起工作正常,我得到了 范围和矩形。不幸的是iOS 10行:

iOS 9

返回if let rangeStart = textInput.position(from: textInput.beginningOfDocument, offset: location)

nil

1 个答案:

答案 0 :(得分:1)

textView.isSelectable = true

此行在iOS 9中是必需的(在iOS 10中不是必需的)。