tvos

How to select buttons in tvOS menu for SpriteKit game

家住魔仙堡 提交于 2019-12-22 07:59:54
问题 I am extending my iOS game for tvOS. Most of the game controls are handled by touchesBegan , touchesMoved and touchesEnded . All my select buttons are handled in the following way: if button1.contains(location){ let gameplayScene = GamePlayScene(size: self.size) self.view?.presentScene(gameplayScene) } if button2.contains(location){ let settingsScene = SettingsScene(size: self.size) self.view?.presentScene(settingsScene) } if button3.contains(location){ let helpScene = HelpScene(size: self

How to loop video with AVPlayerLooper

早过忘川 提交于 2019-12-22 03:40:13
问题 I try to loop a video in a TV OS app with the AVPlayerLooper because this should get rid of the pause/hicup when playing the video again. I watched the WWDC2016 video https://developer.apple.com/videos/play/wwdc2016/503/ and try to implement the code but it doesn't loop. I have one PlayerViewController which inherits AVPlayerViewController . I put the code to let the video loop. If I have the following code, it shows nothing. If I change the second line to self.queuePlayer = AVQueuePlayer

Forced Touch with tvOS

我只是一个虾纸丫 提交于 2019-12-21 20:24:35
问题 Does anybody know how to detect a forced touch/click on the remote control with tvOS? I want to use the click in a Sprite Kit scene to open a 'game paused alert'. I have no UIKit controls which have the focus and will react on the click. I'm already using the 'normal' touch events on the remote control to move my sprites around. 回答1: Apple suggests using UIPressesEvent 's to detect presses/clicks. override func pressesBegan(presses: Set<UIPress>, withEvent event: UIPressesEvent?) { for item

Unexpected motion effect oscillations in tvOS

自闭症网瘾萝莉.ら 提交于 2019-12-21 13:42:20
问题 I am experiencing motion effect oscillations using the following code import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { self.window = UIWindow(frame: UIScreen.mainScreen().bounds) self.window!.rootViewController = ExampleController() self.window!.makeKeyAndVisible() return true } } class ExampleController:

Generate the Dominant Colors for an RGB image with XMLHttpRequest

◇◆丶佛笑我妖孽 提交于 2019-12-21 04:42:36
问题 A Note For Readers: This is a long question, but it needs a background to understand the question asked. The color quantization technique is commonly used to get the dominant colors of an image. One of the well-known libraries that do color quantization is Leptonica through the Modified Median Cut Quantization (MMCQ) and octree quantization (OQ) Github's Color-thief by @lokesh is a very simple implementation in JavaScript of the MMCQ algorithm: var colorThief = new ColorThief(); colorThief

Change background color for page control

試著忘記壹切 提交于 2019-12-20 06:42:19
问题 Is there any way to change background color of page control in tvOS ? NOTE : i want to set background color as clear color I have try the below code, but it is not working in tvOS . var pageControl : UIPageControl! pageControl = UIPageControl(frame: CGRectMake(0, self.view.frame.height - 200, self.view.frame.width, 50)) pageControl.pageIndicatorTintColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 0.70) pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()

Using TVPosterImage in TVUIKit for tvOS 12

会有一股神秘感。 提交于 2019-12-20 04:55:23
问题 tvOS 12 has a new framework TVUIKit, which introduces the lockup views. The class I am interested in is TVPosterView, which is basically designed as such: Swift 4.2 open class TVPosterView : TVLockupView { // One may use UIControl to implement it in iOS public init(image: UIImage?) open var image: UIImage? // default is nil open var title: String? open var subtitle: String? } In my storyboard I have added an UIView element, and rightly (at least I hope so. Yesterday the IB agent kept crashing

tvOS UITextField blank after editing

跟風遠走 提交于 2019-12-20 02:27:33
问题 Editing UITextField in tvOS shows a new view where the user can enter in text, and when text entry is done, the user is returned to the previous view. However, I have found that when I return from the text editor, the text I edit does not show up in my text fields. What's going on? tvOS version 9.1 回答1: The reason why it isn't working is because the UITextField is using a non-default background color. Apparently in tvOS, the background color is rendered to the layer after the text has been

UITextView not Scrolling in tvOS

℡╲_俬逩灬. 提交于 2019-12-19 03:24:37
问题 I have a UITextView in my TV app, when i try to make it focusable then the UI is not making it focusable and i am unable to scroll it. I read some questions about it and some says that its a known issue and we should use storyboards. Actually i am using storyboards but still unable to get this to work. I have also tried to make it selectable , scrollEnabled and userInteractionEnabled and then finally also tried this line of code but none of them is working. descriptionLbl.panGestureRecognizer

How do I play a video on tvOS for Apple TV?

末鹿安然 提交于 2019-12-18 10:35:45
问题 I started a blank tvOS project and created the following code: - (void)viewDidLoad { [super viewDidLoad]; AVPlayer *avPlayer = [AVPlayer playerWithURL:[NSURL URLWithString:@"http://www.myurl.com/myvideo.mp4"]]; AVPlayerLayer *avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayer]; avPlayerLayer.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); [self.view.layer addSublayer:avPlayerLayer]; [avPlayer play]; } Nothing happens in the simulator though once