Re: [問題] UITextView改變height

看板MacDev作者 (龍野南雲)時間6年前 (2017/07/21 17:24), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《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://www.ptt.cc/bbs/MacDev/M.1500629063.A.399.html

07/21 17:30, , 1F
感謝!我再試試看怎麼做
07/21 17:30, 1F
文章代碼(AID): #1PSSX7EP (MacDev)
文章代碼(AID): #1PSSX7EP (MacDev)