02.04.2013 Views

QuickTime Kit Programming Guide - filibeto.org

QuickTime Kit Programming Guide - filibeto.org

QuickTime Kit Programming Guide - filibeto.org

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C H A P T E R 5<br />

Extending the QT<strong>Kit</strong>Player To Stream Audio and Video<br />

}<br />

NSMutableArray *mUrlArray;<br />

BOOL mIsSheet;<br />

3. Define a class method with the following line of code:<br />

+ (id)openURLPanel;<br />

4. Define the getters you need with the following lines of code:<br />

-(NSString *)urlString;<br />

- (NSURL *)url;<br />

5. Define the setters with the following line of code:<br />

- (void)setURLArray:(NSMutableArray *)urlArray;<br />

6. Define the delegate with the following line of code:<br />

- (void)awakeFromNib;<br />

7. Define the notifications:<br />

- (void)writeURLs:(NSNotification *)notification;<br />

8. Define the actions you need:<br />

(IBAction)doOpenURL:(id)sender;<br />

9. Define the delegate methods:<br />

- (void)beginSheetWithWindow:(NSWindow *)window delegate:(id)delegate<br />

didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo;<br />

Save the file in the Classes folder in your QT<strong>Kit</strong>Player project.<br />

Adding Code To OpenURLPanel.m<br />

In this next sequence of steps, you’ll be adding a larger chunk of code to your OpenURLPanel.m<br />

implementation file.<br />

To begin, in your QT<strong>Kit</strong>Player project, choose File > New File. In the Assistant window for your new<br />

file in Xcode 2.0, select Cocoa > Objective-C class and in the window that opens enter the title<br />

OpenURLPanel.m . (Note that if you check the box in the title window, your implementation will<br />

already be created for you.) Now follow these steps:<br />

1. Insert the following import code at the beginning of your file:<br />

#import "OpenURLPanel.h"<br />

2. Following your import statement, you want to define a constant for specifying user default keys.<br />

Insert this line:<br />

#define kUserDefaultURLsKey @"UserDefaultURLsKey"<br />

Adding Code To Stream Audio and Video 89<br />

2005-11-09 | © 2004, 2005 Apple Computer, Inc. All Rights Reserved.

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

Saved successfully!

Ooh no, something went wrong!