Skip to content

Instantly share code, notes, and snippets.

@RyogaK
Last active May 31, 2016 02:57
Show Gist options
  • Save RyogaK/4de0607c469062f67fb764ae10ccf305 to your computer and use it in GitHub Desktop.
Save RyogaK/4de0607c469062f67fb764ae10ccf305 to your computer and use it in GitHub Desktop.
//
// InsettedTextField.swift
//
// Created by Ryoga Kitagawa on 5/31/16.
//
import Foundation
@IBDesignable class InsettedTextField: UITextField {
@IBInspectable var insetX: CGFloat = 0.0
@IBInspectable var insetY: CGFloat = 0.0
override func textRectForBounds(bounds: CGRect) -> CGRect {
return CGRectInset(bounds, self.insetX, self.insetY)
}
override func editingRectForBounds(bounds: CGRect) -> CGRect {
return CGRectInset(bounds, self.insetX, self.insetY)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment