Easy custom placeholder and growing textView
You can easily adjust the color, font, and position of the placeholder. The height of the textview automatically changes every time you increase or decrease the line in the textview.
- iOS9.0 or higher version
- Swift4.2
TextViewMaster is available through CocoaPods.
pod 'TextViewMaster'
import TextViewMaster
isAnimate: Bool = true //μλλ©μ΄μ
μ¬μ©μ¬λΆ
maxLength: Int = 0 //μ΅λ κΈμμ
minHeight: CGFloat = 0 //μ΅μ λμ΄ μ ν
maxHeight: CGFloat = 0 //μ΅λ λμ΄ μ ν
placeHolder: String = "" //νλ μ΄μ€νλ
placeHolderFont: UIFont = UIFont.systemFont(ofSize: 17) //νλ μ΄μ€νλ ν°νΈ
placeHolderColor: UIColor = UIColor(white: 0.8, alpha: 1.0) //νλ μ΄μ€νλ 컬λ¬
placeHolderTopPadding: CGFloat = 0 //νλ μ΄μ€νλ μ μ¬λ°±
placeHolderBottomPadding: CGFloat = 0 //νλ μ΄μ€νλ μλ μ¬λ°±
placeHolderRightPadding: CGFloat = 5 //νλ μ΄μ€νλ μ€λ₯Έμͺ½ μ¬λ°±
placeHolderLeftPadding: CGFloat = 5 //νλ μ΄μ€νλ μΌμͺ½ μ¬λ°±
let textViewMaster = TextViewMaster()
textViewMaster.delegate = self
inputView.addSubview(textViewMaster)
If you have difficulty applying, please refer to the example folder.
- TextView Set class to "TextViewMaster".
- Set delegate to it's view controller
TextViewMaster inherits from UITextViewDelegate. You can also use UITextViewDelegate by default. Added or modified functions
func growingTextView(growingTextView: TextViewMaster, shouldChangeTextInRange range:NSRange, replacementText text:String) -> Bool
func growingTextViewShouldReturn(growingTextView: TextViewMaster)
func growingTextView(growingTextView: TextViewMaster, willChangeHeight height:CGFloat)
func growingTextView(growingTextView: TextViewMaster, didChangeHeight height:CGFloat)
TextViewMaster is available under the MIT license.