我在我的電視應用程序中有一個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,它可以自動聚焦 –