GithubHelp home page GithubHelp logo

keenteam1990 / ktplaceholdertextview Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 149 KB

:octocat:KTPlaceHolderTextView 继承于UITextView的自定义TextView, 带placeholder

Swift 100.00%
swift placeholder-text uitextview

ktplaceholdertextview's Introduction

KTPlaceholderTextView

⚠️ If you are looking for Swift 2.3 compatible version, please take a look at KTPlaceholderTextView 1.2.2 version. ⚠️

A UITextView subclass that adds support for multiline placeholder written in Swift.

PlaceholderTextView

Usage

You can set the value of the placeholder property just like using UITextField.

Interface Builder

Storyboard

  1. Drag a UITextView object onto the canvas.
  2. In the Identity inspector, set the Custom Class name to KTPlaceholderTextView.
  3. In the Attributes inspector, you can change the value of the placeholder property directly.

Code

let placeholderTextView = KTPlaceholderTextView(frame: view.bounds)
placeholderTextView.placeholder = "What's on your mind?"
view.addSubview(placeholderTextView)

Installation

If you are encountering the following warning when using Xcode 8, please make sure to set the Module in the identity inspector of your KTPlaceholderTextView in the interface builder to KTPlaceholderTextView as well:

warning: IB Designables: Using class UITextView for object with custom class because the class KTPlaceholderTextView does not exist

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate KTPlaceholderTextView into your Xcode project using Carthage, specify it in your Cartfile:

Requirements

  • iOS 7.0+
  • Xcode 8.0+
  • Swift 3.0+

License

KTPlaceholderTextView is released under the MIT license. See LICENSE for details.

ktplaceholdertextview's People

Contributors

keenteam1990 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.