apple-tv

How to get the node and keyboard reference of TVML textField in TVJS?

為{幸葍}努か 提交于 2019-12-08 07:22:54
问题 Someone asked the same question here How do you get the value from a TVML textField? but didn't explain the full answer and my comment there was edited, suggesting me to ask a brand new question. Here it is... Can anyone help understand how to best get a reference to the textField node and its keyboard value from TVML? Right now I'm using this code below in Presenter.js to get to the textField once the user clicks the Done button in the template displaying the form & keyboard, but still get

Siri Remote's Menu Button not exiting application when UIButton is focused

北慕城南 提交于 2019-12-08 01:22:26
问题 I'm overriding pressesBegan to receive Select presses. The Siri Remote's Menu Button does not exit my application when the focus is on a UIButton . If no UI element is focused the Menu Button works as expected. How do I receive Menu Button presses when the focus is on a UIButton ? override func pressesBegan(presses: Set<UIPress>, withEvent event: UIPressesEvent?) { for item in presses { if item.type == .Select { print("Click") } if item.type == .Menu { print("Menu Button") super.pressesBegan

tvOS: Rounded corners for image view when focused

喜夏-厌秋 提交于 2019-12-07 05:54:15
问题 I have an image view that will get this awesome tvOS focus effect when the containing view gets focused. The problem is - it should have rounded corners. Now this is easily done: imageView.layer.cornerRadius = 5 imageView.layer.masksToBounds = true I have to set either masksToBounds of the layer or clipsToBounds of the image view to true (which is basically the same), in order to clip the edges of the image - but as soon as I do this, the focus effect won't work any more, because it will get

How to move the focus from a button to another in tvOS?

时光总嘲笑我的痴心妄想 提交于 2019-12-07 05:49:45
问题 I'm new to tvOS. I would like to have a standard button that once is pressed, it moves the focus to another standard button, how can I do this (if it's possible of course)? 回答1: Start by overriding the preferredFocusedView in your viewController with a custom property: var myPreferredFocusedView:UIView? override var preferredFocusedView: UIView? { return myPreferredFocusedView:UIView } Then, in your button callback, set the myPreferredFocusedView to your next preferred button which should get

How to center UICollectionViewCell that was focused?

狂风中的少年 提交于 2019-12-07 05:17:39
问题 What I want to achieve is very simple: each time user focuses a collection view cell, I want to make the focused cell horizontally centered. It seems like my current approach doesn't work at all. func collectionView(collectionView: UICollectionView, didUpdateFocusInContext context: UICollectionViewFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) { guard collectionView === self.categoryCollectionView else { return } guard let indexPath = context

Setting up Apple TV video JavaScript

烈酒焚心 提交于 2019-12-06 13:53:53
I have a simple function that will launch the player that handles video playback for the Apple TV function launchPlayer() { var player = new Player(); var playlist = new Playlist(); var mediaItem = new MediaItem("video", "http://localhost:9001/videos/nsoperations.mp4"); player.playlist = playlist; player.playlist.push(mediaItem); player.present(); } According to the Player Documentation , all I needed to play a video back is a player, a playlist (docs) , and a media item (docs) . I've got all those, but when running my code, I get an error: Unable to simultaneously satisfy constraints. To my

How to use iOS 5+ AirPlay for a second screen

时光毁灭记忆、已成空白 提交于 2019-12-06 10:29:02
I'm toying with AirPlay using an iPhone 4S and I'm having some trouble. I've updated my Apple TV 2 to the latest (4.4.3 I think? I forget, it's in the other room and I'm too lazy to check) and I have iOS 5.0 on my 4S while I use Xcode 4.2 Build 4D199. I wrote a simple UIView app that attempts to draw on a second screen when available. Here's what I have in my viewDidLoad: - (void)viewDidLoad { [super viewDidLoad]; [self.view addSubview:[[MPVolumeView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)]]; NSLog(@"Registering for screen connect events..."); // Do any additional setup after loading

tvOS 10. PreferredFocusView is deprecated. How do I change to preferredFocusEnvironment?

谁说我不能喝 提交于 2019-12-06 03:57:33
I have a subview for which I have overridden the preferredFocusedView. The subclass has a UIView called viewToFocus. I check if that view exists, if it does I focus that view, if not I return the preferredFocusedView of the parent. Since I updated to tvOS 10 today I am getting the following error: 'preferredFocusedView' is deprecated: first deprecated in tvOS 10.0 - Use -preferredFocusEnvironments instead. I cant find anywhere in the documentation that explains how preferredFocusEnvironment is to be implemented. In the documentation found Supporting Focus within Your App , it says to Override

iPad Mirroring using 2 screens, does it support 1080 resolution?

£可爱£侵袭症+ 提交于 2019-12-06 03:45:26
2.5 years of mac and iOS development and i haven't found an answer to something. I'm working on a project utilizing iOS 5.0 and apple TV's airplay to display one UIScreen on the iPad and a separate one on my Apple TV. I have 2 separate view controllers and they display fine on each respectively. The issue is that the apple tv screen size returns at 720p not 1080p. So i get a bordered view controller at 1280 X 720 displayed and not a full screen representation of 1920 x 1080. The effect is my view controller is cropped not scaled. I tried the naughty things like changing screen bounds of the

Customize Keyboard in tvOS

眉间皱痕 提交于 2019-12-05 05:40:31
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 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't identical to what happens in the YouTube app, but it's probably the closest you can get. From the Apple