Skip to content

devxoul/UITextView-Placeholder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5a133b7 Â· Jan 30, 2020

History

94 Commits
Jul 31, 2019
Jan 5, 2020
Apr 12, 2016
Jul 31, 2019
May 8, 2019
Dec 10, 2014
Jul 31, 2019
Dec 10, 2014
Jan 2, 2020
May 21, 2018
Jan 30, 2020

Repository files navigation

UITextView+Placeholder

Build Status CocoaPods

A missing placeholder for UITextView.

Installation

Use CocoaPods.

pod 'UITextView+Placeholder'

Usage

  • Import Dynamic Framework:

    e.g. If you're using CocoaPods with use_frameworks! flag.

    @import UITextView_Placeholder;
  • Import Static Library:

    #import <UITextView+Placeholder/UITextView+Placeholder.h>

Then create UITextView and set placeholder.

  • Implement Objective-C:

    UITextView *textView = [[UITextView alloc] init];
    textView.placeholder = @"How are you?";
    textView.placeholderColor = [UIColor lightGrayColor]; // optional
    textView.attributedPlaceholder = ... // NSAttributedString (optional)
  • Implement Swift:

    let textView = UITextView()
    textView.placeholder = "How are you?"
    textView.placeholderColor = UIColor.lightGray // optional
    textView.attributedPlaceholder = ... // NSAttributedString (optional)

Congratulations! You're done. 🎉

License

UITextView+Placeholder is under MIT license. See the LICENSE file for more information.