作者herbacin (herbacin)
看板MacDev
标题[问题] 关於取得元件问题
时间Tue Jan 10 18:52:07 2017
请问一下各位大大
假设我在ViewController 加入了两个 UITextView
var textView1 = UIView(frame: CGRect(x:0, y:0, width:100, height:100))
var textView2 = UIView(frame: CGRect(x:100, y:100, width:100, height:100))
textView1.delegate = self
textView2.delegate = self
self.view.addSubView(textView1)
self.view.addSubView(textView2)
func textViewDidBeginEditing(_ textView: UITextView) {
//问题 :请问这边要如何判断是 textView1在进行编辑
还是 textView2在进行编辑呢?
}
麻烦各位非常感谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.250.132.73
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MacDev/M.1484045530.A.163.html
1F:推 Esvent: 把两个textView作为成员变数存起来 跟参数比较 01/10 18:55
2F:→ darktt: if textView == self.textView1 01/10 18:56
3F:→ darktt: 或是采用view的tag来辨识 01/10 18:57
4F:→ herbacin: 非常感谢两位 01/10 19:04