Ok, bizarre ici.UITextView défilement est inversé sur tvOS
J'ai un UITextView que je remplis avec une chaîne attribuée. Le TextView ne veut pas faire défiler par lui-même si je dois permettre à certains paramètres, notamment:
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()
}
Cependant, la mise en ScrollView Ils provoquent pour faire défiler la manière inversée par rapport à tout le reste sur tvOS. Vraiment bizarre. Le code complet de la classe est la suivante:
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
})
})
}
}
}
mine est pas la même que la question connexe parce que je ne cherche pas à écarter des normes tvOSs
double possible de [inverti Scrolling dans UICollectionView de tvOS] (http://stackoverflow.com/questions/34685150/invert-scrolling-in-uicollectionview-of-tvos) – Fantini