tvos

Programmatically sleep Apple TV on tvos

故事扮演 提交于 2020-01-04 05:37:14
问题 I'd like to have a sleep timer within my own tvos app. Is there a way to enable/disable sleeping on tvos? I know you disable sleeping using: [UIApplication sharedApplication].idleTimerDisabled = YES; But is there a way to then enable sleep right away when a timer finishes? 来源: https://stackoverflow.com/questions/33639783/programmatically-sleep-apple-tv-on-tvos

Any way to control which audio channel AVSpeechSynthesizer outputs to?

穿精又带淫゛_ 提交于 2020-01-03 16:36:51
问题 I would like to use AVSpeechSynthesizer to output sound on only one audio channel of a multi-channel surround sound setup. For example, in a 5.1 system, I would like it to output on just the right-surround channel. Right now I have: let synthesizer = AVSpeechSynthesizer() let utterance = AVSpeechUtterance(string: "This is the right channel") synthesizer.speakUtterance(utterance) ...however it outputs on both the left and right channels. 来源: https://stackoverflow.com/questions/32558183/any-way

Any way to control which audio channel AVSpeechSynthesizer outputs to?

亡梦爱人 提交于 2020-01-03 16:36:10
问题 I would like to use AVSpeechSynthesizer to output sound on only one audio channel of a multi-channel surround sound setup. For example, in a 5.1 system, I would like it to output on just the right-surround channel. Right now I have: let synthesizer = AVSpeechSynthesizer() let utterance = AVSpeechUtterance(string: "This is the right channel") synthesizer.speakUtterance(utterance) ...however it outputs on both the left and right channels. 来源: https://stackoverflow.com/questions/32558183/any-way

How to use both native and TVML in a tvOS app?

时光怂恿深爱的人放手 提交于 2020-01-02 20:45:52
问题 Is it possible to use both native views/controllers and TVML in a tvOS app? It seems that using TVML requires you to set an "app controller" instead of a normal view controller. How can you use both TVML and native components in a tvOS app? 回答1: Yes, you can use both Native and TVML in the same app. You can register your class object in evaluateAppJavaScriptInContext method of App Delegate. func appController(appController: TVApplicationController, evaluateAppJavaScriptInContext jsContext:

Sprite Kit game crashes on Game Over on tvOS 9.1 and iOS 9.2

自作多情 提交于 2020-01-02 16:14:49
问题 I have a Sprite Kit game that is crashing when the game is over. This happening on the tvOS 9.1 and iOS 9.2. Before, I had it running on iOS 9.1 without crashing. It seems to be an OpenGL issue, but when I search the function in Xcode, it doesn't come up with anything. Unfortunately, the error is not consistent in appearing in the console. Here's the error: Jet: draw_indexed: indexType must be 'unsigned_int' or 'unsigned_short' Assertion failed: (indexType == jet_component_type_unsigned_int |

How do you set canBecomeFocused for a custom view

故事扮演 提交于 2020-01-02 09:12:26
问题 I am making an application for tvOS. I have a view that contains a UIButton and a custom UIView that contains a couple other custom views. The simulator is only able to highlight the UIButton and not the custom view. According to the Building Apple TV Apps Docs: If your custom view needs to be focusable, override canBecomeFocused to return YES (by default, it returns NO). According to the canBecomeFocused Docs: canBecomeFocused will return YES if the view can become focused; NO otherwise.

How to check if Dark Appearance is enabled tvOS

烂漫一生 提交于 2020-01-02 07:58:13
问题 How do I check if a user has enabled Dark Appearance on their Apple TV? 回答1: Using UIUserInterfaceStyle, first available in tvOS 10, we can check what appearance the user has set. For example: func checkInterfaceStyle() { guard(traitCollection.responds(to: #selector(getter: UITraitCollection.userInterfaceStyle))) else { return } let style = traitCollection.userInterfaceStyle switch style { case .light: print("light") case .dark: print("dark") case .unspecified: print("unspecified") } } Also,

How to check if Dark Appearance is enabled tvOS

大兔子大兔子 提交于 2020-01-02 07:58:06
问题 How do I check if a user has enabled Dark Appearance on their Apple TV? 回答1: Using UIUserInterfaceStyle, first available in tvOS 10, we can check what appearance the user has set. For example: func checkInterfaceStyle() { guard(traitCollection.responds(to: #selector(getter: UITraitCollection.userInterfaceStyle))) else { return } let style = traitCollection.userInterfaceStyle switch style { case .light: print("light") case .dark: print("dark") case .unspecified: print("unspecified") } } Also,

Customize Keyboard in tvOS

放肆的年华 提交于 2020-01-02 02:54:07
问题 I use UISearchController to search inline with keyboard, textfield and results in one screen. Does tvOS allow to customize keyboard? I want to use dark design, but I don't know how to customize the keyboard. For example YouTube app did that. They have black screen with white keyboard 回答1: A UISearchController has a UISearchBar , which conforms to UITextInputTraits . This means it has a keyboardAppearance which you can set to UIKeyboardAppearanceDark to get a dark keyboard appearance. This isn

UIButton on different Y level can't be focused on tvOS

守給你的承諾、 提交于 2020-01-02 01:19:26
问题 I started developing apps for Apple TV and I have this problem whit buttons. I have a screen where are several buttons on bottom of the screen and then there is one, which is in the middle (see screenshot to understand). The problem is that I can't get focused the middle button. Focus is only on bottom three buttons. The problem is obviously caused by the Y position , when I move the button on bottom of the screen, it gets focused. Buttons are created in storyboard, there is no code in