Latest 0.1.5
Homepage https://github.com/caixiang305621856/CXTextView
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

效果

使用说明

- (CXTextView *)textView{
    if (!_textView) {
        _textView = [[CXTextView alloc] initWithFrame:CGRectMake(0, 0, self.width, 100)];
        _textView.initiLine = 2;
        _textView.maxLine = 4;
        _textView.v_margin = 10;
        _textView.h_margin = 15;
        _textView.maxLength = 500;
        _textView.placeholder = @"说点什么吧";
        _textView.backgroundColor = [UIColor whiteColor];
        _textView.textView.tintColor = CXRGB(234, 111, 91);
        _customTextViewHeight = ceil(_textView.font.lineHeight * _textView.initiLine) + 2*_textView.v_margin;
        //高度改变
        __weak __typeof(self)weakSelf = self;
        _textView.textHeightChangeBlock = ^(CGFloat height) {
            __strong __typeof(weakSelf)sSelf = weakSelf;
            if (sSelf->_customTextViewHeight != height) {
                sSelf->_customTextViewHeight = height;
                [sSelf setNeedsLayout];
                [sSelf layoutIfNeeded];
            }
        };
        //文字改变
        _textView.textDidChangeHandlerBlock = ^(UITextView *textView) {
            __strong __typeof(weakSelf)sSelf = weakSelf;
            if ([[textView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length]==0) {
                sSelf.toolBarView.canClick = NO;
            } else {
                sSelf.toolBarView.canClick = YES;
            }
        };
        //最大字数回调
        _textView.textLengthDidMaxHandlerBlock = ^(UITextView * _Nonnull textView) {
            NSLog(@"👱弹出自己业务的提示👱");
        };
    }
    return _textView;
}

Installation

CXTextView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'CXTextView'

Author

[email protected] 小作坊开发者

License

CXTextView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "CXTextView",
    "version": "0.1.5",
    "summary": "CXTextView",
    "description": "u81eau5b9au4e49UITextView u89e3u51b3u6362u884cu6587u5b57u88abu622au65adu7684u6548u679cuff0cu4effu5f88u591au8bc4u8bbau6846u6548u679c",
    "homepage": "https://github.com/caixiang305621856/CXTextView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "[email protected]": "[email protected]"
    },
    "source": {
        "git": "https://github.com/caixiang305621856/CXTextView.git",
        "tag": "0.1.5"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "CXTextView/Classes/**/*"
}

Pin It on Pinterest

Share This