Reputation: 2913
I am curious to know if anyone has had any success programmatically setting a Top Shelf image in a tvOS app? I've read through a few tutorials (such as this one) that details setting the Top Shelf image in either a sectioned
or inset
style, but I'm curious if anyone knows a way to choose a static image (in the 1920x720 resolution), based on a set of criteria. I'm interested in choosing a different 1920x720 image based on time of day.
I've played around a bit with the TVTopShelfProvider
class, but I'm not seeing a way to choose anything but the bundled image in your assets.
Thanks!
Upvotes: 2
Views: 1108
Reputation: 12363
There are two completely different approaches to the Top Shelf.
use the 1920.720 (and 2x that) image, which is simply in the icons assets of the normal app
create a TV Top Shelf extension, which is a whole app unto itself
If you are using "1" - "just an image in the icons file" - in fact it seems there is NO WAY to dynamically set that image. It's just a static image, exactly like (say) the app icon.
Maybe this has changed recently, but that seems to be the situation.
Upvotes: 0
Reputation: 119031
With TVTopShelfProvider
you can supply content which with points to a local image on the device or an image somewhere on the internet. This is done with the imageURL
of the TVContentItem
returned in topShelfItems
. Whenever you change the contents of topShelfItems
you need to post TVTopShelfItemsDidChangeNotification
so the device knows that an update is required.
Upvotes: 2