Skip to content

sunilsharma08/CustomTextView

Repository files navigation

CustomTextView

CustomTextView makes easy to customise textview.

CustomTextView

Feature

  • Resizeable textview
  • Character limit
  • Show/hide send button
  • TextView min - max height
  • Support placeholder text

How to use

Drag the folder "CustomTextView" with the source files into your project.

Create instance of CustomTextView

let customtTextView: CustomTextView = CustomTextView(frame: CGRectMake(0,80,320,40))

and start using it.

Placeholder

Plain placeholder

customtTextView.placeholder = "Write something..."

Attributed placeholder

customtTextView.textView.placeholderAttributedText = NSAttributedString(string: "Write something...", 
                                                    attributes: [NSForegroundColorAttributeName: UIColor(white: 0.8, alpha: 1)])

Character limit

var maxCharCount:Int?

Show/hide total character

var showCharCount:Bool?

Show/hide send button button on right side

var showSendButton:Bool

Give padding to textview

var textViewInsets:UIEdgeInsets

Delegates

This is optional delegate method and this is called whenever textview size is changed.
Parameters:
customTextView - TextView

func customTextViewDidResize(customTextView: CustomTextView)

This is optional delegate method. This method is called when user click on send button.
Parameters:
customTextView - TextView
message - String in textview

func customTextView(customTextView: CustomTextView, didSendMessage message: String)

This is optional delegate method. This method is called whenever character in textview change.This method can be ued to update character count.
Parameters:
currentChar - Total number of character currently present in textview.
maxChar - Max character allowed.

func updateCharacterCount(currentChar:Int,maxChar:Int)

##Contribution Contributions are welcome.Just open an issue on GitHub to discuss a point or request a feature or send a Pull Request with your suggestion.

#License CustomTextView is available under the MIT license.

About

Expandable textview ios

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages