CMInputView
💪之前代码是基于UITextView进行的封装,侵入性较强,不方便使用,现使用Category重构代码,支持Cocoapods
Because the original code use inheritance which is too intrusive, now I use category to reconstruct the code, and released new version 。 The project is written primarily in Objective-C, distributed under the MIT License license, first published in 2016. Key topics include: cocoapods, inputview, ios, objective-c, placeholder.

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
<a id="screenshots"></a>Screenshots

<a id="installation"></a>Installation
CocoaPods:
- For iOS8+:
rubyuse_frameworks! target '<Your Target Name>' do pod 'UITextView+CMInputView' end
Manually:
- Drag all files under
CMInputView/CMInputView/Classfolder into your project.
<a id="pre-knowledge"></a>Pre-knowledge
<a id="example"></a>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. 🎉
<a id="notes"></a>Notes
- The category do not support constrained layout,please use carefully !
- Once you set
cm_maxNumberOfLines,the effect always works,even if you setYEStocm_autoLineBreak
<a id="support"></a>Support this repo
License
"UITextView+CMInputView" is available under the MIT license. See the LICENSE file for more info.
Contributors
Showing top 1 contributor by commit count.
