Latest 0.1.0
Homepage https://github.com/CrabMen/CMInputView
License MIT
Platforms ios 8.0, requires ARC
Authors

UITextView+CMInputView

UITextView+CMInputView
UITextView+CMInputView
UITextView+CMInputView

DECLARATION:

Because the original code use inheritance which is too intrusive, now I use category to reconstruct the code, and released new version 。

Table of contents

Screenshots

效果展示

Installation

CocoaPods:

  • For iOS8+:
use_frameworks!
target '<Your Target Name>' do
    pod 'UITextView+CMInputView'
end

Manually:

  • Drag all files under CMInputView/CMInputView/Class folder into your project.

Pre-knowledge

Example

Firstly, you need import the .h file.

if cocoaposd:

#import <UITextView+CMInputView.h>

if manually:

#import "UITextView+CMInputView.h"

Then create UITextView and use this category to configure .

   UITextView * inputView = [[UITextView alloc]initWithFrame:CGRectMake(0, 100, self.view.bounds.size.width, 55)];
    inputView.font = [UIFont systemFontOfSize:18];

    inputView.cm_placeholder =  @"UITextView+CMInputView";
    inputView.cm_placeholderColor = [UIColor redColor];
    inputView.cm_maxNumberOfLines = 3;

    [self.view addSubview:inputView];

If you want to make the UITextView break line automatically ,you can write like this:

     UITextView * inputView = [[UITextView alloc]initWithFrame:CGRectMake(0, 100, self.view.bounds.size.width, 55)];
    inputView.font = [UIFont systemFontOfSize:18];

    inputView.cm_placeholder =  @"UITextView+CMInputView";
    inputView.cm_placeholderColor = [UIColor redColor];
    inputView.cm_autoLineBreak = YES;

    [self.view addSubview:inputView];

Congratulations! You’re done. 🎉

Notes

  • The category do not support constrained layout,please use carefully !
  • Once you set cm_maxNumberOfLines ,the effect always works,even if you set YES to cm_autoLineBreak

Support this repo

  • ★Star this repo
  • If you find somes bugs or need some new functions,please issue me

License

"UITextView+CMInputView" is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "UITextView+CMInputView",
    "version": "0.1.0",
    "summary": "A category that can configure the UITextView",
    "homepage": "https://github.com/CrabMen/CMInputView",
    "license": "MIT",
    "authors": {
        "CrabMan": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/CrabMen/CMInputView.git",
        "tag": "0.1.0"
    },
    "source_files": "**/Class/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This