DigitalLeaves / PlaceholderTextViewDemo

A IBDesignable subclass of UITextView with a placeholder behaving like a UITextfield

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PlaceholderTextView

PlaceHolderTextView is a IBDesignable subclass of UITextView with a placeholder behaving like a UITextfield, which means that if no text is present, the placeholder will be showing. This makes it easier to integrate UITextViews in combination of UITextFields where all the elements should have placeholders.

There is a full tutorial on how to build your custom IBDesignable controls for XCode6 here.

Usage

Just drag & drop the file PlaceholderTextView.swift into your project. Then in the Interface Builder, add a UITextView to any of your UIViewControllers.

Click on the Identity Inspector (the icon that looks like an id card or a user profile page on the utilities right panel). Write "PlaceholderTextView" in the "Class" field, and you are ready!

Use the Attribute Inspector to change the placeholder text and color. You can also change the corner radius for rounded edges, and set the width and color of the border around the PlaceholderTextView.

License

The MIT License (MIT)

Copyright (c) 2015 Ignacio Nieto Carvajal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A IBDesignable subclass of UITextView with a placeholder behaving like a UITextfield


Languages

Language:Swift 100.0%