ios - UITextField Caret stops moving around when too large -


uitextfield allows override -caretrectforposition: in subclasses. want caret cover text field's entire height.

- (cgrect)caretrectforposition:(uitextposition *)position {     cgrect inherited = [super caretrectforposition:position];     inherited.origin.y = -50.0;     inherited.size.height = 200.0;      return inherited; } 

if make large (like in example), stop moving around magnifying glass, making user unable switch part of text.

why , how can address problem?

i figured issue when trying make caret way larger text field was. making cover entire editing rect worked fine.

- (cgrect)caretrectforposition:(uitextposition *)position {     cgrect const inherited = [super caretrectforposition:position];     cgrect const rect = ({         cgrect rect = inherited;         rect.origin.y = 0.0;         rect.size.height = cgrectgetheight([self editingrectforbounds:self.bounds]);         rect;     });      return rect; } 

bonus: in case you're trying selection range view same height, take @ -selectionrectsforrange: , adjust size of rects accordingly. need subclass uitextselectionrect make mutable though.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -