在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:STTextView开源软件地址:https://gitee.com/yanglishuan/STTextView开源软件介绍:#STTextView STTextView可以设置placeHolder和字符个数,达到字符限制不能再输入;另外还添加了字符变化的block回调,方便开发者使用。 #define MAXLENGTH 100STTextView *textView = [[STTextView alloc] initWithFrame:CGRectMake(20, 84, self.view.bounds.size.width - 40, 120)]; textView.placeholder = [NSString stringWithFormat:@"写点什么吧,最多%@个字", @(MAXLENGTH)]; textView.maxLength = MAXLENGTH; textView.font = [UIFont systemFontOfSize:15]; [textView setTextDidChangeBlock:^(UITextView *textView) { _countLabel.text = [NSString stringWithFormat:@"还可以写%@个字", @(MAXLENGTH - textView.text.length)]; }]; textView.layer.borderColor = [UIColor lightGrayColor].CGColor;textView.layer.borderWidth = 1.0;textView.layer.opacity = .7;[self.view addSubview:textView]; |
请发表评论