UITextView with placeholder
来源:互联网 发布:阿里云邮寄幕布要钱吗 编辑:程序博客网 时间:2024/05/10 11:05
class TMTextView: UITextView { private var placeholderLabel: UILabel! func setPlaceholder(placeholderText: String) { NSNotificationCenter.defaultCenter().addObserver(self, selector: "textDidChange", name: UITextViewTextDidChangeNotification, object: nil) self.placeholderLabel = UILabel(frame: CGRectZero) self.addSubview(self.placeholderLabel) self.placeholderLabel.font = self.font let size = (placeholderText as NSString).sizeWithAttributes([NSFontAttributeName: self.font]) self.placeholderLabel.frame = CGRect(x: 5, y: 5, width: size.width, height: size.height) self.placeholderLabel.text = placeholderText } func textDidChange() { self.placeholderLabel.hidden = !self.text.isEmpty } deinit { NSNotificationCenter.defaultCenter().removeObserver(self) }}
0 0
- UITextView with placeholder
- UItextView Placeholder
- UITextView placeholder
- UITextView 添加placeholder
- UITextView 实现placeholder
- IOS UITextView加上placeholder
- UITextView实现placeholder
- UITextView实现Placeholder功能
- UITextView placeholder 设置
- UITextView添加Placeholder(swift)
- iOS UITextView加上placeholder
- IOS UITextView加上placeholder
- UITextView添加placeholder属性
- 给UITextView添加PlaceHolder
- UITextView 的placeholder
- UITextView 的placeholder
- UITextView 实现 placeholder
- UITextView的placeholder属性
- Thinking in java第8天
- openCV2连续读取图像序列
- mysql创建数据库指定编码格式
- 从springmvc源码看方法参数绑定的注解和返回值处理
- 三点顺序
- UITextView with placeholder
- iOS --- 获取iOS设备的电量信息:Battery Level
- matlab中strel()与imerode()的使用
- #299 (div.2) A. Tavas and Nafas
- 结构体的初始化
- Face alignment in 3000 FPS 代码的运行
- 不作死就不会死-大公司之开发流程之折腾(一)
- MAC下的UML画图工具
- Lombok简介