In xcode and tvos, is it possible to convert the top shelf image to an image stack? - xcode

In xcode, and tvos, the 3D parallax icons in the asset catalog are shown as image stacks. But this is not the case with the so called top shelf image.
Is it possible to convert the top shelf image to a multi layer image stack in xcode?

Only content that is focusable is multilayered and then you need to provide several of them.
There are 3 top shelf types, but unfortunately none of them fit your needs.
You can read more about them in apple tv human interface guide lines.
1) single, static top shelf image
Provide a visually rich static image. Your app’s static top shelf
image is used when dynamic content isn’t provided or is unavailable.
Use it as an opportunity to highlight your brand.
Don’t imply interactivity in a static image. The static top shelf
image isn’t focusable, so it shouldn't include elements that make it
appear interactive.
2) "Dynamic Content Layouts" - "Sectioned Content Row"
this is for content similar to portrait movie posters. those can be multilayered, but:
Provide enough content to constitute a complete row. At a minimum,
load enough images in a sectioned content row to span the full width
of the screen.
3) "Dynamic Content Layouts" - "Scrolling Inset Banner"
this is for content similat to wide screen advertising banners. those can be multilayered, but:
A minimum of three images is recommended for a scrolling banner to
feel effective.

To make Dynamic Content you need an Apple TV extension. To include a layered image in the content use the Apple Parallax Previewer app to load all the images in the layered image, and export as an LSR file. Drop the LSR into an Apple TV Extension target. Use the code below to create a scrolling inset (rather than a sectioned one as in the RW tutorial). Then read in the file from the app bundle.
Note that the Top Shelf will "scroll through" your images so you probably want 3 related layered images (as the above answer suggests). You can see what a single image looks like (pretty lame) in this video.
import Foundation
import TVServices
class ServiceProvider: NSObject, TVTopShelfProvider {
override init() {
super.init()
}
// MARK: - TVTopShelfProvider protocol
var topShelfStyle: TVTopShelfContentStyle {
// Return desired Top Shelf style.
return .inset
}
var topShelfItems: [TVContentItem] {
let v1Ident = TVContentIdentifier(identifier: "V1", container: nil)!
let v1Content = TVContentItem(contentIdentifier: v1Ident)!
v1Content.imageURL = Bundle.main.url(forResource: "v1", withExtension: ".lsr")
// Create an array of TVContentItems.
return [v1Content]
}
}

Related

Resizing image to fit Ui Image View in xcode storyboard

I am trying to fit an image to fit the entire of the Ui Image View. I want to do this because I want to round my image and it does not work because the image is smaller than the entire view. So rounding it rounds the outside of the image and is not visible. I have tried to add constraints but that does not seem to have workout.
Here is an image of what I am trying to do:
https://i.stack.imgur.com/mIGow.png
The problem images:
https://i.stack.imgur.com/LGDyx.png
https://i.stack.imgur.com/K3RVZ.png
OK - the problem is that you don't understand the Xcode interface.
When you have added a UIImageView, set its image, and then select it, you see this:
If you click the image view again, Xcode shows an additional "highlight" outline:
That has nothing to do with how it will look when you run your app.
Regarding the screen-cap from the video you are watching... You either didn't notice, or forgot, two things:
it's a tutorial for SwiftUI - the screen-caps you've posted for what you're trying to do is from a UIKit based app.
at 17:20 of Part 1 of that series, the author explains how he is setting the corner radius.
To get what you want with UIKit, you need to write some code to give the image view rounded corners. To have it show up at design-time, you need to use an #IBDesignable image view subclass.
Here's a very basic example:
#IBDesignable
class RoundedImageView: UIImageView {
override func layoutSubviews() {
layer.cornerRadius = 20
}
}
If you set the Custom Class of your image view to RoundedImageView, and then either select either Editor -> Refresh All Views or have Editor -> Automatically Refresh Designable Views checked, you'll see this:

Drag to resize a bitmap with createJS & Canvas

I'm working on a basic design app where the user can upload images to a canvas, drag them around and resize them. The problem I have is resizing the image with a mouse drag. I'd like the user to position the mouse pointer on either corner of the bitmap image and drag either towards or away from the bitmap to resize it proportionally. I'd be grateful for any code or suggestions.
Lanny mentioned that you had this question here. ZIM, which is based on CreateJS has this functionality built in - it is called transform(). We also have an uploader built in called Loader().
Here is the code that you would use inside the ZIM template available on the code page at ZIM https://zimjs.com
const loader = new Loader().center();
loader.on("loaded", e=>{
e.bitmap.center().transform();
// or if you want multiple files
// loop(e.bitmaps, bitmap=>{
// bitmap.center().transform();
// });
loader.removeFrom();
stage.update();
});
Below is an image that has been loaded. You can try it here https://zimjs.com/explore/uploadresize.html. The transform interface will go away when the user clicks off the image and then comes back when they click on the image. There are various options for all of this that you can read about in the Docs available on the ZIM site.
All your regular CreateJS will work and you will find that ZIM is helpful in many other ways too! Aside from transform() there is drag() for normal dragging, and gesture() for pinch zoom and rotate - you would use one or the other of these not combined.

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

Do you know why this is happening and most important how to fix it?
Adding the key with what value?
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 is displayed on the Apple TV. So, if you're using any text or images that you don't want cut off make sure to make them centered in those dimensions. For example:
The areas in red are only used for sliding in your top shelf image when your app icon becomes highlighted on the Apple TV home screen.
EDIT:
Check your target's Build Settings.

What is the proper method to make sprites for iOS games in SpriteKit?

I have two questions.
What is the proper method to transfer the physical art I make on paper to a computer so that it utilized as SpriteKit?
What is the proper method to create Sprites on a Mac to be utilized in Xcode7?
This is generally covered in the Working With Sprites documentation. Here's a high-level overview though.
You want to create a "textured sprite" which is "the primary way that you bring custom artwork into a scene".
"This custom artwork might represent characters in your game, background elements, or even user interface elements, but the basic strategy is the same. An artist creates the images, and your game loads them as textures. Then you create sprites with those textures and add them to the scene."
Or in other words, scan your drawings in using any software. Touch them up and make the background transparent (if you want) using image editing software like Photoshop or Pixelmator. Export the result as a PNG file. Drag this file into your Xcode library to import the file into your project.
Then, using the filename, just make an SKSpriteNode object. Here's the Objective-C code from the docs:
SKSpriteNode *spaceship = [SKSpriteNode spriteNodeWithImageNamed:#"rocket.png"];
spaceship.position = CGPointMake(100,100);
[self addChild: spaceship];
Here's the same code in Swift:
let spaceship = SKSpriteNode(imageNamed: "rocket.png")
spaceship.position = CGPoint(x: 100, y: 100)
addChild(spaceship)
I recommend reading that entire document if you have more questions; it's very thorough.

Set object properties depending on Size Class in iOS8

I am new to iOS development, I have read about size classes, I have a question about setting properties (or just calling methods with some parameter) depending on ViewController's size class. I am developing a simple radio app, for app design I decided to use Collection View in which I want display logo image. Because I develop universal app and I want to place images in 3 columns or rows on both iPhone snd iPad versions, I need 4 Collection Views for iPhone and iPad for portrait and landscape orientations. For example for iPhone's Collection View I set 75x75 image size for cell, for iPad's 200x200. So for one object (radio station) I need to create 2 image sets, because I do not want just to use the biggest iPad's images on iPhone for two reasons: higher CPU usage, scale issues.
So question is which is the best solution to create objects in array for Collection View with appropriate image size depending on Size Class? Is it good solution to use UITraitCollection to determine Size Class in the viewDidLoad method?
You question indicates you need first to take time to learn some stuff on iOS.
Like you I had to start and learn : it is no problem.
have a closer to auto layoutin iOS
www.raywenderlich.com
then see how easy and fun is iOS development (just need to practice to understand how easy it is). Here is a tutorial for collection views:
www.raywenderlich.com
image scaled
in your image asset
place image with name terminated with
nothing, #2x, 3x
-> easy way to scale image : I use sketch.

Resources