好的,這裏很奇怪。UITextView滾動在tvOS上翻轉
我有一個UITextView,我用一個屬性字符串填充。 TextView的不希望自身滾動,所以我必須啓用一些設置,具體爲:
override func viewDidLoad() {
super.viewDidLoad()
articleText.isUserInteractionEnabled = true
articleText.isSelectable = true
articleText.isScrollEnabled = true
articleText.panGestureRecognizer.allowedTouchTypes = [NSNumber(value: UITouchType.indirect.rawValue)]
articleText.bounces = true
setup()
}
然而,設置這些引起了滾動滾動倒置的方式相比,一切都在tvOS東西。真是離奇。滿級的代碼如下:
class ArticleViewController : UIViewController, ListingViewControllerProtocol {
var listing : ListingData?
@IBOutlet weak var articleText: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
articleText.isUserInteractionEnabled = true
articleText.isSelectable = true
articleText.isScrollEnabled = true
articleText.panGestureRecognizer.allowedTouchTypes = [NSNumber(value: UITouchType.indirect.rawValue)]
articleText.bounces = true
setup()
}
func setup(){
if let listing = self.listing {
APIManager.sharedInstance.getShortendArticle(url: listing.url, onCompletion: { (json) in
let article = ShortendArticle(fromJson: json)
let html = "<h1>" + article.title + "</h1>" + article.content
DispatchQueue.main.async(execute: {
let theAttributedString = try! NSAttributedString(data: html.data(using: String.Encoding.utf8, allowLossyConversion: false)!,
options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType],
documentAttributes: nil)
self.articleText.attributedText = theAttributedString
})
})
}
}
}
煤礦是不一樣的相關問題,因爲我並不想從tvOSs標準
[在tvOS的UICollectionView反向滾動]的可能的複製(http://stackoverflow.com/questions/34685150/invert-scrolling-in-uicollectionview-of-tvos) – Fantini