πŸ“±Easy custom placeholder and growing textView
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example update example (safearea issue) Feb 1, 2019
TextViewMaster.xcodeproj change name Jan 25, 2019
TextViewMaster swift 4.2지원 Jan 25, 2019
.gitignore Init JSGrowingTextView Dec 12, 2017
.swift-version Update .swift-version Jan 25, 2019
LICENSE.md Rename License to LICENSE.md Jan 25, 2019
README.md Update README.md Jan 25, 2019
TextViewMaster.podspec Update TextViewMaster.podspec Jan 25, 2019
intro.gif Add files via upload Dec 12, 2017

README.md

TextViewMaster

Version License: MIT Platform Swift 4.2

Introduce

image

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.

Requirements

  • iOS9.0 or higher version
  • Swift4.2

Installation

Cocoapods

TextViewMaster is available through CocoaPods.

pod 'TextViewMaster'

Usage

import TextViewMaster

Customization

    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                             //ν”Œλ ˆμ΄μŠ€ν™€λ” μ™Όμͺ½ μ—¬λ°±

Programmatically

let textViewMaster = TextViewMaster()
textViewMaster.delegate = self       
inputView.addSubview(textViewMaster)

If you have difficulty applying, please refer to the example folder.

Storyboard

  1. TextView Set class to "TextViewMaster".
  2. Set delegate to it's view controller

Delegate

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)

Author

jeasungLEE

License

TextViewMaster is available under the MIT license.