我面临一个间隔问题,在IOS 13中有一个正确的UITextField视图,请参阅下面的ios 13和ios 12.4的代码和屏幕截图
在IOS 12.4中,模拟器在UITextField的右视图(UITextField)中显示适当的空间
在IOS 13.0中,模拟器在UITextField的右视图(UITextField)中有一个间隔问题
let dropdownButton = UIButton(frame: CGRect(x: 0, y: 0, width: 50, height: txtField.frame.height))
dropdownButton.backgroundColor = UIColor.clear
dropdownButton.setImage(UIImage(named: "ic_DownArrow"), for: UIControl.State())
txtField.rightView = dropdownButton
txtField.rightViewMode = .always
发布于 2019-10-30 01:55:15
我喜欢同样的问题,把它设置为:
覆盖textField rightViewRectForBounds:
方法,
- (CGRect)rightViewRectForBounds:(CGRect)bounds {
if (self.rightView) {
CGRect rightFrame = self.rightView.frame;
return CGRectMake(bounds.size.width - rightFrame.size.width, 0, rightFrame.size.width, bounds.size.height);
}
return CGRectZero;
}
https://stackoverflow.com/questions/58166160
复制相似问题