[英]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.