博客> UITexView设置placeholder
UITexView设置placeholder
2017-05-21 06:17 评论:0 阅读:188 zzczheng
ios cell button 点击cell上的按钮时执行点击按钮的方法

self.addressView = [[UITextView alloc] initWithFrame:CGRectMake(10, 160, kScreenW - 20, 50)]; self.addressView.backgroundColor = [UIColor whiteColor]; self.addressView.text = @"请输入详细地址"; self.addressView.textColor = [UIColor grayColor]; self.addressView.delegate = self; self.addressView.font = [UIFont systemFontOfSize:15.0];

pragma mark--UITextView代理方法

  • (void)textViewDidBeginEditing:(UITextView *)textView {

    if ([textView.text isEqualToString:@"请输入详细地址"]) { textView.text = @""; textView.textColor = [UIColor blackColor]; } }

  • (void)textViewDidEndEditing:(UITextView *)textView { if (textView.text.length<1) { textView.text = @"请输入详细地址"; textView.textColor = [UIColor grayColor]; } }
收藏
0
sina weixin mail 回到顶部