Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

📱Easy custom placeholder and growing (iMessage-like) UITextView with customisation

License

NotificationsYou must be signed in to change notification settings

RanduSoft/RSTextViewMaster

 
 

Repository files navigation

VersionLicense: MITPlatformSwift 4.2

Intro

image

📱Easy custom placeholder and growing (iMessage-like) UITextView with customisation

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.You can specify a maxHeight property so the textview can start to scroll.

Requirements

  • iOS 9.0 or newer
  • Swift 4.2

Installation

Cocoapods

RSTextViewMaster is available throughCocoaPods.

pod'RSTextViewMaster'

Usage

importRSTextViewMaster

Set text

For the moment, please usetextView.setText(text: String) to update textview's text. By using.text settler, the placeholder won't be removed. This will get fixed in future updates.

Customization

isAnimate:Bool=truemaxLength:Int=0minHeight:CGFloat=0maxHeight:CGFloat=0placeHolder:String=""placeHolderFont:UIFont=UIFont.systemFont(ofSize:17)placeHolderColor:UIColor=UIColor(white:0.8,alpha:1.0)placeHolderTopPadding:CGFloat=0placeHolderBottomPadding:CGFloat=0placeHolderRightPadding:CGFloat=5placeHolderLeftPadding:CGFloat=5

Programmatically

lettextViewMaster=RSTextViewMaster()textViewMaster.delegate=selfinputView.addSubview(textViewMaster)

You will have to set constrains by code if you take this approach.

Storyboard

  1. TextView Set class to "RSTextViewMaster".
  2. Set delegate to it's view controller
  3. Set a height constraint but check "remove at runtime". This way Xcode won't bother you and the textview will work like magic

Check the demo for an example.

Delegate

RSTextViewMaster inherits from UITextViewDelegate.You can also use UITextViewDelegate by default.Added or modified functions

funcgrowingTextView(growingTextView:RSTextViewMaster,shouldChangeTextInRangerange:NSRange,replacementTexttext:String) ->BoolfuncgrowingTextViewShouldReturn(growingTextView:RSTextViewMaster)funcgrowingTextView(growingTextView:RSTextViewMaster,willChangeHeightheight:CGFloat)funcgrowingTextView(growingTextView:RSTextViewMaster,didChangeHeightheight:CGFloat)

Author

RSTextViewMaster is based onJeaSungLEE'swork

License

RSTextViewMaster is available under the GNU license.

About

📱Easy custom placeholder and growing (iMessage-like) UITextView with customisation

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift90.3%
  • Ruby9.7%

[8]ページ先頭

©2009-2025 Movatter.jp