I am using swift 2.0. I have one uitext field for username. Now I also placed the placeholder for that. But when I start typing, the value starts from very corner of that textfield. I need to start slightly before form the corner point for uitext field. Here is my image, this only I need to change.
When I enter any value its starting from very corner. I need to start slightly after that corner point (in swift).
import UIKit
class CustomTextField: UITextField {
required init?(coder aDecoder: NSCoder){
super.init(coder: aDecoder)
}
override func textRectForBounds(bounds: CGRect) -> CGRect {
return CGRectMake(bounds.origin.x + 10, bounds.origin.y + 8, bounds.size.width - 20, bounds.size.height - 16);
}
override func editingRectForBounds(bounds: CGRect) -> CGRect {
return self.textRectForBounds(bounds);
}
}
class ViewController: UIViewController {
@IBOutlet weak var FirstFiels: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}