tvos

How can I force focus to change to a specific view in tvOS?

放肆的年华 提交于 2020-01-01 08:33:22
问题 I am implementing custom code to handle a click on the Menu button on the Siri Remote. How can I force focus to change to my custom menu when pressing the menu button? 回答1: Finally figured it out myself. You have to override the preferredFocusedView property of your UIView or UIViewController . In Swift it works like this: func myClickHandler() { someCondition = true self.setNeedsFocusUpdate() self.updateFocusIfNeeded() someCondition = false } override weak var preferredFocusedView: UIView? {

How can I force focus to change to a specific view in tvOS?

被刻印的时光 ゝ 提交于 2020-01-01 08:32:29
问题 I am implementing custom code to handle a click on the Menu button on the Siri Remote. How can I force focus to change to my custom menu when pressing the menu button? 回答1: Finally figured it out myself. You have to override the preferredFocusedView property of your UIView or UIViewController . In Swift it works like this: func myClickHandler() { someCondition = true self.setNeedsFocusUpdate() self.updateFocusIfNeeded() someCondition = false } override weak var preferredFocusedView: UIView? {

Why is there a space between the cells in my UITableView

瘦欲@ 提交于 2020-01-01 04:02:40
问题 I have UITableView with 1 section and 10 rows with blue background. Why am I getting space between the cells? How do I remove it? 回答1: This is the default behaviour on tvOS. This way there is space to scale up the cell which has focus without the scaled cell overlapping its neighbours. 回答2: To avoid spacing , you can set tableview background as your cell's contentView background. 来源: https://stackoverflow.com/questions/33364236/why-is-there-a-space-between-the-cells-in-my-uitableview

How can I put an Apple TV app in background after pressing the Menu button

我的未来我决定 提交于 2019-12-31 03:01:04
问题 I have tried to use a private method to put the app in background after pressing the Menu button; and the following code works properly: @implementation ViewController { UITapGestureRecognizer *tapRecognizer; } -(void)viewDidLoad { [super viewDidLoad]; tapRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)]; tapRecognizer.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypeMenu]]; [self.view addGestureRecognizer:tapRecognizer]; } -(void

How can I put an Apple TV app in background after pressing the Menu button

℡╲_俬逩灬. 提交于 2019-12-31 03:01:02
问题 I have tried to use a private method to put the app in background after pressing the Menu button; and the following code works properly: @implementation ViewController { UITapGestureRecognizer *tapRecognizer; } -(void)viewDidLoad { [super viewDidLoad]; tapRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)]; tapRecognizer.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypeMenu]]; [self.view addGestureRecognizer:tapRecognizer]; } -(void

Set font family in TVML

帅比萌擦擦* 提交于 2019-12-30 11:20:07
问题 In my TVML app I am able to set font style properties such as font-size and font-weight using tv-text-style:none, however I am not able to set the font-family property, which seems to be ignored: var Template = function() { return `<?xml version="1.0" encoding="UTF-8" ?> <document> <head> <style> .customText { tv-text-style: none; tv-position: center; color: white; font-size: 40px; font-weight: bold; font-family: Courier; } </style> </head> <paradeTemplate> ... <listItemLockup> <title>Title<

Invalid Image Asset -Top Shelf Image - must be opaque

。_饼干妹妹 提交于 2019-12-30 08:02:04
问题 I am getting ERROR ITMS-90497 , Invalid Image Asset -Top Shelf Image - must be opaque , when using this image: I'm just testing with this image to get it working and trying to submit a tvOS application to TestFlight. 回答1: The PNG image you're using contains Alpha Channels. Open the image with Preview and go to File>Export>Uncheck Alpha>Save. This will save the image without Alpha Channels. 来源: https://stackoverflow.com/questions/32834660/invalid-image-asset-top-shelf-image-must-be-opaque

Archive upload failed with error: ITMS-90470 Missing TVTopShelfImage.TVTopShelfPrimaryImageWide key

≡放荡痞女 提交于 2019-12-30 04:38:24
问题 Do you know why this is happening and most important how to fix it? Adding the key with what value? 回答1: Starting in tvOS 10 you must include a wide top shelf image, Top Shelf Image Wide , with a size of 2320px by 720px @1x . tvOS Human Interface Guidelines: Icons and Images. If Top Shelf Image Wide is not already in your Assets.xcassets you can create one manually, or with the + Add a Group or Image Set button. For example: The crop area is still 1920px x 720px @1x when the top shelf image

Can I mix UIKit and TVMLKit within one app?

≡放荡痞女 提交于 2019-12-28 03:38:05
问题 I'm exploring tvOS and I found that Apple offers nice set of templates written using TVML . I'd like to know if a tvOS app that utilises TVML templates can also use UIKit . Can I mix UIKit and TVMLKit within one app? I found a thread on Apple Developer Forum but it does not fully answer this question and I am going through documentation to find an answer. 回答1: Yes, you can. Displaying TVML templates requires you to use an object that controls the JavaScript Context: TVApplicationController .

Binary operator '==' cannot be applied to operands of type '[MKAnnotation]' and 'MKAnnotation'

别说谁变了你拦得住时间么 提交于 2019-12-25 15:53:45
问题 I'm working on a tvOS app, where I want to be able to swipe between annotations. I store my annotations in a Dictionary, and store the Dictionary in an Array for future use. I am simply plotting three annotations for Canada, USA, and Mexico. I want to be able to swipe on the remote between these annotations. When an annotation is clicked, it will take you to information about that country. let countriesArray = ["Canada", "Mexico", "United States of America"] var annotationArray =