In einem meiner Spiele verwende ich eine UICollectionView als Ebene Auswahlmenü. Ich habe vor kurzem programmgesteuert ein UIPageControl hinzugefügt.UIPageControl hat Hintergrund auf tvOS
/// Page control
func setupPageControl() {
pageControl.hidesForSinglePage = true
pageControl.numberOfPages = DataSource.worlds
pageControl.translatesAutoresizingMaskIntoConstraints = false
pageControl.currentPageIndicatorTintColor = DataSource.pageControlColors[pageControl.currentPage]
pageControl.pageIndicatorTintColor = UIColor.white.withAlphaComponent(0.8)
pageControl.addTarget(self, action: #selector(didPressPageControl), for: .valueChanged)
view.addSubview(pageControl)
let leading = NSLayoutConstraint(item: pageControl, attribute: .leading, relatedBy: .equal, toItem: view, attribute: .leading, multiplier: 1, constant: 0)
let trailing = NSLayoutConstraint(item: pageControl, attribute: .trailing, relatedBy: .equal, toItem: view, attribute: .trailing, multiplier: 1, constant: 0)
let bottomConstant = Device.isPad ? view.frame.width/9 : view.frame.width/17
let bottom = NSLayoutConstraint(item: pageControl, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: -bottomConstant)
view.addConstraints([leading, trailing, bottom])
}
Alles ist auf iOS in Ordnung, aber auf tvOS hat der Pagecontroller einen durchscheinenden Hintergrund, die alle über den Bildschirm erstreckt.
Wie kann ich das abschalten? Ich habe versucht, die pageControl Hintergrundfarbe einzustellen, aber das scheint nicht zu funktionieren.
Mögliche Duplikat [Hintergrundfarbe ändern für Seitensteuerung] entfernen (http://stackoverflow.com/questions/33235857/change -background-color-for-page-Kontrolle) – Moshe