• Stars
    star
    164
  • Rank 230,032 (Top 5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

💪之前代码是基于UITextView进行的封装,侵入性较强,不方便使用,现使用Category重构代码,支持Cocoapods

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.

More Repositories

1

CMPageTitleView

✍️一分钟集成类似抖音,新浪微博,腾讯视频,网易新闻,今日头条等常见的标题栏样式,api灵活易扩展,支持Cocoapods和Masonry布局,支持ChildController的完整生命周期
Objective-C
309
star
2

flutter_tab_indicator

📱A Flutter library to add the Common effect (line, bubble, dot ...) of tab indicator.
Dart
18
star
3

weapp-profile-mask

😷个人微信小程序(已发布),共抗疫情,你的头像戴口罩了吗?
JavaScript
16
star
4

CMCollectionFlowLayouts

👊几种常用的FlowLayout,瀑布流,表情布局,3D翻页效果,风火轮(圆形)效果等
Objective-C
15
star
5

DataStructureAndAlgorithms-365Days

👨‍💻请允许我用翻译腔描述这个仓库:真是见鬼,其实我也并不太了解这该死的数据结构和算法。看在上帝的份上,我们为什么不去LeetCode刷一道题呢?哦,我是说,可以顺便等等那些真正会解这道题的人来告诉我们答案,我发誓,在LeetCode会有这样的人的。还有什么会比等待答案更令人兴奋的呢?该死,现在还没有人star或者是fork这个仓库,而且,我的宝贝儿,像我这样愚蠢的像驴子一般的人写出的答案竟然有人赞同,真是太不可思议了!嘿,你们这些还没有star或fork的人!小心我用靴子狠狠踢你们的屁股!我发誓我真的会这样做!
Java
9
star
6

CMContactsManager

通讯录相关操作封装,适配iOS8及其以后
Objective-C
6
star
7

flutter_wechat_timeline_post

flutter 3.10.0 仿微信朋友圈发布界面
C++
3
star
8

Category

分类
Objective-C
2
star
9

CMEmojiManager

emoji表情管理类
2
star
10

react-native-waves

waves of react-native
JavaScript
2
star
11

iOSInteractWithJS

The Interaction of iOS native with JS
Objective-C
1
star
12

flutter_application_template

flutter_application_template
Dart
1
star
13

CMTestModules

测试模块()
Objective-C
1
star
14

react-native-amazing-utils

⌨️coding 暂嫑使用
JavaScript
1
star
15

AliasAndSnippet

common alias of macos and snippet of Xcode;management of develop env
Shell
1
star
16

CMResources

各仓库用到的素材
1
star
17

Yasuko

Ghost Theme
CSS
1
star
18

CMCutomeTitleBar

自定义的标题栏--- 四种风格
Objective-C
1
star
19

Daily-Commit

我住隔壁 名老王 满墙绿色 我帮忙🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀 🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀 🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀 🍀🍀🍀🍀🍀🍀🍀🍀🍀🍀
Shell
1
star
20

NSDate-Common

NSDate的分类,里面包含了常用的一些方法,日期的转换,计算等...
Objective-C
1
star