作者Blueshiva (龙野南云)
看板MacDev
标题Re: [问题] UITextView改变height
时间Fri Jul 21 17:24:20 2017
※ 引述《prince0124 (Jay)》之铭言:
: 请问一下
: 我在storyboard设定UITextView排版的时候,height设成0,
: 之後在用textfield里的pickerview选到某个特定的选项时,
: 我想让我的textView的height变长,不知道我这样的程式码对不对,
: 麻烦大家帮我看一下!谢谢!
: func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent
: c
: if pickerView.tag == 1 {
: projectField.text = projectData[row]
: if projectData.count == 2 {
: textview = UITextView(frame: CGRect(x: 47.5, y: 333, width: 280, h
: eight: 50
上面这行要改成
textview.frame.size = newSize
self.view.layoutIfNeeded()
: }
: } else {
: insuranceField.text = insuranceData[row]
: }
: }
另外要注意的是,这是不是在 main thread 被呼叫,如果不是的话就要另外自己把
code 丢到 main thread 执行
--
Luna quieres ser madre
y no encuentras querer
que te haga mujer
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 59.115.54.35
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MacDev/M.1500629063.A.399.html
1F:推 prince0124: 感谢!我再试试看怎麽做 07/21 17:30