[英]UITextView not scrolling when created programmatically
我正在以編程方式創建 UITextView。
content = UITextView(frame: CGRect(x: 0, y: header.frame.origin.y + header.frame.size.height, width: self.frame.size.width, height: self.frame.size.height - viewTop.frame.size.height))
content.font = UIFont.init(name: "OpenSans", size: 17)
content.textColor = UIColor.black
content.backgroundColor = UIColor.white
content.isUserInteractionEnabled = true
content.isScrollEnabled = true
content.isEditable = true
content.isSelectable = true
content.bounces = true
content.showsVerticalScrollIndicator = true
self.addSubview(content)
雖然它沒有滾動。
只有當內容大小大於 textView 的框架時,TextView 才會滾動。 因此,在使用足夠的文本設置 textView 的文本時,應該允許它滾動。
您已將內容視圖添加到它自己。 將此更改為查看,它將滾動。
view.addSubview(content)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.