objective c - iOS moving cursor from keyboard extension -
we can update cursor position of uitextfield this.
[textfield setselectedrange:beginningrange];
is possible update cursor position keyboard extension? checking textdocumentproxy , inputview though.
simply set length of selection zero.
one possible implementation:
+ (void)setcursorintextfield:(uitextfield *)textfield atindex:(nsinteger)index { uitextposition *start = [textfield positionfromposition:[textfield beginningofdocument] offset:index]; uitextposition *end = [textfield positionfromposition:start offset:0]; [textfield setselectedtextrange:[textfield textrangefromposition:start toposition:end]]; }
Comments
Post a Comment