13.07.2015 Views

Beginning Objective-C pdf - EBook Free Download

Beginning Objective-C pdf - EBook Free Download

Beginning Objective-C pdf - EBook Free Download

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 7: User Interfaces: The Application Kit 219It is also possible to fill a path using a gradient. To do this, you use one of NSGradient’s-drawInBezierPath: methods. Figure 7-16 shows the result of using the same path witha radial gradient via -drawInBezierPath:relativeCenterPosition:.Figure 7-16. A gradient within a bezier pathVideo PlaybackOS X provides many tools for working with media, primarily centered within the AVFoundationframework. It provides a quite intricate and slightly low-level approach to handling media,however, concentrating more on manipulation and the ability to handle lots of different eventsand status changes. When you want to just play a movie, Apple has you covered with the QTKitframework, which provides a high-level interface to the QuickTime media playback system.In this section you’ll create a simple document-based application for viewing movie files. Tostart, open Xcode and create a new Cocoa Application. Check the “Create Document-BasedApplication” checkbox and uncheck “Use Core Data” and “Include Unit Tests” because youwon’t need them. In fact, you’ll need barely a dozen lines of code in total!Defining DocumentsSave the project and select the project in the Project Navigator (it’s the item at the very top of thelist). Then select the Summary pane in the editor.If you have a Mac Developer account or a Developer ID with which to code-sign yourapplications, select the “Enable Entitlements” and “Enable App Sandboxing” checkboxes andselect “Read Access” from the User Selected File Access pop-up.Under the Linked Frameworks section, click the Add button and choose QTKit.framework fromthe chooser window that appears.Now switch to the Info pane of the editor. In here, pop open the Document Types section andedit the information to appear similar to that shown in Figure 7-17. The primary information toenter is that in the Identifier field: the UTI (Uniform Type Identifier) of public.movie. This willensure that all files that contain movie data (that is, contain both video and audio) are openableby this application. Also ensure that your application’s Role value is Viewer because you don’twant to think about editing these movies; you just want to display them.www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!