Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devxoul/uitextview-placeholder

A missing placeholder for UITextView
https://github.com/devxoul/uitextview-placeholder

objective-c placeholder uitextview

Last synced: 1 day ago
JSON representation

A missing placeholder for UITextView

Awesome Lists containing this project

README

        

UITextView+Placeholder
======================

[![Build Status](https://travis-ci.org/devxoul/UITextView-Placeholder.svg?branch=master)](https://travis-ci.org/devxoul/UITextView-Placeholder)
[![CocoaPods](http://img.shields.io/cocoapods/v/UITextView+Placeholder.svg?style=flat)](http://cocoapods.org/?q=name%3AUITextView%2BPlaceholder)

A missing placeholder for UITextView.

Installation
------------

Use [CocoaPods](http://cocoapods.org).

```ruby
pod 'UITextView+Placeholder'
```

Usage
-----

- **Import Dynamic Framework**:

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

```objc
@import UITextView_Placeholder;
```

- **Import Static Library**:

```objc
#import
```

Then create `UITextView` and set `placeholder`.

- **Implement Objective-C**:

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

- **Implement Swift**:

```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](LICENSE) file for more information.