先上图来看看:
正确的
错误的
解决办法
解决输入框位置显示不对
- (CGRect)rightViewRectForBounds:(CGRect)bounds {
CGRect rightViewRect = [super rightViewRectForBounds:bounds];
if (@available(iOS 13.0, *)) {
CGFloat left = self.frame.size.width - self.rightView.frame.size.width;
CGFloat top = round((self.frame.size.height - self.rightView.frame.size.height)/2.0);
rightViewRect = CGRectMake( left, top, self.rightView.frame.size.width , self.rightView.frame.size.height);
} else {
}
return rightViewRect;
}
- (CGRect)leftViewRectForBounds:(CGRect)bounds {
CGRect leftViewRect = [super leftViewRectForBounds:bounds];
if (@available(iOS 13.0, *)) {
CGFloat top = round((self.frame.size.height - self.leftView.frame.size.height)/2.0);
leftViewRect = CGRectMake(0, top, self.leftView.frame.size.width, self.leftView.height);
} else {
}
return leftViewRect;
}
喜欢的话,给个星星哟,如果没有解决你的问题,也可以留言,我看到了,会想想解决办法的