我在我的电视应用程序中有一个UITextView
,当我尝试使它可以焦点时,然后用户界面没有使其可聚焦,我无法滚动它。我读了一些关于它的问题,有人说它是一个已知的问题,我们应该使用故事板。其实我正在使用故事板,但仍然无法得到这个工作。我也试图使它selectable
,scrollEnabled
和userInteractionEnabled
然后最后也尝试了这一行代码,但他们都没有工作。UITextView不滚动在tvOS
descriptionLbl.panGestureRecognizer.allowedTouchTypes = [NSNumber(integer: UITouchType.Direct.rawValue)]
我也试图打印bounds
ABD中UITextView
的contentSize
这里是日志
Content Size (740.0, 914.0)
Bounds (25.0, 0.0, 740.0, 561.0)
这里是我的代码可一些身体帮我
@IBOutlet weak var descriptionLbl: UITextView!
var currentModel : Model?
override func viewDidLoad() {
super.viewDidLoad()
descriptionLbl.selectable = true
descriptionLbl.scrollEnabled = true
descriptionLbl.userInteractionEnabled = true
descriptionLbl.panGestureRecognizer.allowedTouchTypes = [NSNumber(integer: UITouchType.Direct.rawValue)]
descriptionLbl.text = (currentModel?.description)! + (currentModel?.description)! + (currentModel?.description)!
descriptionLbl?.contentInset = UIEdgeInsets(top: 0.0, left: -25.0, bottom: 0.0, right: 0.0);
}
我想我应该不要做这些许多技巧,但它不以任何方式工作。重点实际上是UITextView
,但它不滚动。有任何想法吗?
它是如何聚焦的? – user3160965
通过使其userInteractionEnabled,它可以自动聚焦 –