Contents

aspectRatio

Specifies the aspect ratio of an image.

Overview

Use the aspectRatio attribute when setting the image’s contentsMode to provide TVMLKit with the context needed to determine how to fit the source image in the view port.

The attribute’s value should correlate with the aspect ratio of the source image. The value is a double derived by dividing the width of the aspect ratio by the height. Here’s an example that demonstrates the aspectRatio attribute used to specify a source image with a 3 to 2 width to height ratio.

<img contentsMode="aspectFit" width="300" height="200" aspectRatio="1.5" src="path to images on your server/Car_Movie_300x200.png"/>

Elements that Use aspectRatio

See Also

Image Size