zoukankan      html  css  js  c++  java
  • iOS Dev (60) 怎样实现 UITextView 中的 placeHolder

    iOS Dev (60) 怎样实现 UITextView 中的 placeHolder

    作者:阿锐 地址:http://blog.csdn.net/prevention

    -

    跟着你的 UITextView 定义一个 UILabel。

    UILabel *inputPlaceHolder;
    

    placeHolder 是当有内容时不显示。无内容时显示,所以能够为所在的实例相应的类实现 UITextViewDelegate 中例如以下方法。

    - (void)textViewDidChange:(UITextView *)textView
    {
        if (textView.text.length == 0)
        {
            inputPlaceHolder.text = @"输入内容";
        }
        else
        {
            inputPlaceHolder.text = @"";
        }
    }
    

    注意设置该 label 的 delegate 是所在实例。

    inputPlaceHolder.delegate = self
    inputPlaceHolder.text = @"输入内容"
    
    • 这批那文章来自 blog.csdn.net/prevention ,转载请注明。

    -

    转载请注明来自:http://blog.csdn.net/prevention

  • 相关阅读:
    CSU 1122
    CSU 1256
    CSU 1240
    HDU 1874
    CSU 1004
    Problem F CodeForces 16E
    Problem E CodeForces 237C
    Problem C FZU 1901
    12-30
    2016-12-29
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5129627.html
Copyright © 2011-2022 走看看