UITextView

 _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=@"";

    }

}





阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/helloworld183/article/details/52369924
想对作者说点什么? 我来说一句

placeholder

2015年08月21日 357B 下载

uitextview

2014年01月01日 1.02MB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭