- 由于密码输入框是第三方提供商提供的安全键盘,在使用的过程中,光标位置一直在输入框的最左侧边框位置,与边框紧挨着,与界面设计效果不相符。
- 为了实现相适应的页面效果,就需要对密码键盘的光标位置进行右移。
- 实现代码如下:
- 为输入框添加一个左侧的视图,占据输入框左侧位置,将输入框有效的输入区域右移,进而实现光标的右移。
UIView *firstPasswordBlankView = [[UIView alloc] initWithFrame:CGRectMake(_firstPasswordTextField.frame.origin.x,_firstPasswordTextField.frame.origin.y,10.0, _firstPasswordTextField.frame.size.height)];
_firstPasswordTextField.leftView = firstPasswordBlankView;
_firstPasswordTextField.leftViewMode = UITextFieldViewModeAlways;