我有一个UITextView
在我的电视应用程序中,当我尝试使其可聚焦时,用户界面无法使其可聚焦,并且我无法滚动它。我读到了一些有关它的问题,有些人说这是一个已知问题,我们应该使用故事板。实际上我正在使用故事板,但仍然无法让它发挥作用。我也曾尝试过selectable
, scrollEnabled
and userInteractionEnabled
然后最后也尝试了这行代码,但它们都不起作用。
descriptionLbl.panGestureRecognizer.allowedTouchTypes = [NSNumber(integer: UITouchType.Direct.rawValue)]
我也尝试过打印bounds
abd contentSize
of the UITextView
这是日志
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
但它不滚动。有任何想法吗?