关闭

UITextView

61人阅读 评论(0) 收藏 举报

 _textView = [[UITextView alloc]init];

        _textView.backgroundColor = [UIColor whiteColor];

        _textView.delegate = self;

        [cell.contentView addSubview:_textView];

        [_textView mas_makeConstraints:^(MASConstraintMaker *make) {

            make.edges.mas_equalTo(0);

        }];

        _placeholdeView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bottlefive.png"]];

        [cell.contentView addSubview:_placeholdeView];

        [_placeholdeView mas_makeConstraints:^(MASConstraintMaker *make) {

            make.left.mas_equalTo(10);

            make.bottom.mas_equalTo(-10);

            make.size.mas_equalTo(CGSizeMake(282/3, 282/3));

        }];

        _addView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"dgn-gr-grz-bj3@3x.png"]];

        [_addView addTapGestureRecognizerWith:self action:@selector(clickaddView:)];

        [cell.contentView addSubview:_addView];

        [_addView mas_makeConstraints:^(MASConstraintMaker *make) {

            make.left.mas_equalTo(_placeholdeView.mas_right).offset(10);

            make.bottom.mas_equalTo(-10);

        }];


   _placeholerLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 40)];

        _placeholerLabel.textAlignment = NSTextAlignmentLeft;

        _placeholerLabel.font = [UIFont systemFontOfSize:14];

        _placeholerLabel.text = @"请输入内容";

        [_textView addSubview:_placeholerLabel];



-(void)textViewDidChange:(UITextView *)textView{

    if (textView.text.length ==0) {

        _placeholerLabel.text = @"请输入内容";

    }

    else{

        _placeholerLabel.text=@"";

    }

}





0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:40761次
    • 积分:1429
    • 等级:
    • 排名:千里之外
    • 原创:106篇
    • 转载:0篇
    • 译文:0篇
    • 评论:4条
    文章分类
    最新评论