textView中的placeholderLabel

 _explainView = [[UITextView alloc]init];

       // _explainView.backgroundColor = [UIColor colorWithRed:236.0/255 green:241.0/255 blue:238.0/255 alpha:1];

        _explainView.backgroundColor = [UIColor whiteColor];

        _explainView.delegate = self;

        _explainView.font = [UIFont systemFontOfSize:18];

        _explainView.layer.borderColor = [UIColor colorWithRed:236.0/255 green:241.0/255 blue:238.0/255 alpha:1].CGColor;

        _explainView.layer.borderWidth = 1.0;

        [cell.contentView addSubview:_explainView];

        [_explainView mas_makeConstraints:^(MASConstraintMaker *make) {

            make.left.mas_equalTo(_explainLabel.mas_right).offset(5);

            make.top.mas_equalTo(imageView.mas_top);

            make.bottom.mas_equalTo(-10);

            make.right.mas_equalTo(-10);

        }];

        

        _placeHolderView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"vgz-sp-wplq6"]];

        [_explainView addSubview:_placeHolderView];

        [_placeHolderView mas_makeConstraints:^(MASConstraintMaker *make) {

            make.left.mas_equalTo(0);

            make.top.mas_equalTo(10);

            make.size.mas_equalTo(CGSizeMake(28/2, 31/2));

        }];

//

        _placeholderLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 150, 40)];

        _placeholderLabel.textAlignment = NSTextAlignmentLeft;

        _placeholderLabel.font = [UIFont systemFontOfSize:18];

        _placeholderLabel.text = @"请输入任务完成详细说明";

        _placeholderLabel.textColor = [UIColor grayColor];

        [_explainView addSubview:_placeholderLabel];

        [_placeholderLabel mas_makeConstraints:^(MASConstraintMaker *make) {

            make.left.mas_equalTo(_placeHolderView.mas_right).offset(1);

           // make.centerY.mas_equalTo(_placeHolderView.mas_centerY);

            make.size.mas_equalTo(CGSizeMake(140, 20));

            make.top.mas_equalTo(10);

            

        }];

        

        

        

    }

    return cell;

}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    if (indexPath.section==0) {

        

        return 60;

    }else if (indexPath.section==1){

        return 60;

    }else if (indexPath.section==2){

        return 170;

        

    }

    return 80;

    

}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{

    return 20;

    

}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, tableView.tableHeaderView.frame.size.height)];

    view.backgroundColor = [UIColor colorWithRed:230.0/255 green:238.0/255 blue:233.0/255 alpha:1];

    return view;

    

}


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

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

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

        

           }

    else{

        _placeholderLabel.text=@"";

        

//        _placeHolderView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@""]];

        

        _placeHolderView.hidden = YES;

        

    }

}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值