O'Reilly logo

Professional iPhone® Programming with MonoTouch and .NET/C# by Rory Blyth, Chris Hardy, Craig Dunn, Martin Bowling, Wallace B. McClure

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Programming with Multimedia

WHAT'S IN THIS CHAPTER?

  • Integrating images and the image picker

  • Watching and recording videos

  • Playing and recording audio

  • Using animation

Multimedia covers a broad range of items in the real world. Within the iPhone context, multimedia covers images, audio, video, and animation. The iPhone creates an innovative way of consuming multimedia, which hasn't gone unnoticed in the general media. The iPhone APIs provide an easy way of interacting with the multimedia functions of the device. We discuss each of the multimedia items throughout this chapter.

IMAGES

This section covers using images within your application, whether you want to display images, pick images, or even create your own.

Displaying Images

To use and display images within a view, you can use the UIImageView control. UIImageView is a simple control that allows two basic actions: the ability to view an image and the ability to view multiple images with animations.

To view images, you can either drag a UIImageView into the design view using Interface Builder or you can create a UIImageView in code. For this example, you create your UIImageView in code.

First you want to grab an image that you may have from your application. You can do this by using the static method FromFile on the UIImage class, passing in the path to the file.

Note

Make sure you have included your image in the project and set the image's build action to Content; otherwise the image will not show. You can do this by right-clicking ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required