Я использовал эту область кода ранее:
override func textRect(forBounds bounds: CGRect) -> CGRect {
super.textRect(forBounds: bounds)
return UIEdgeInsetsInsetRect(bounds, UIEdgeInsets(top: 0,left: 10, bottom: 0, right: 10))
}
Но после Xcode, Swift Update выдает ошибку.Вот ошибка:
'UIEdgeInsetsInsetRect' has been replaced by instance method 'CGRect.inset(by:)'
А потом я написал это:
override func textRect(forBounds bounds: CGRect) -> CGRect {
super.textRect(forBounds: bounds)
var animationRect = frame.inset(by: UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 10))
return animationRect
}
Но приведенный выше код не влияет на текстовое поле.Что я должен написать, чтобы дать отступ слева?