开发者

Trying to understand QTCompressionOptionsWindowTest

I'm trying to build an application that uses QTKit, with some compress options. I saw this example in the apple developer page QTCompressionOptionsWindow that uses a Window for that purpose.

in MyController.m line 65 there is a comment:

// ******** Compression Options Window *****

开发者_如何转开发// create our window with the media type and set ourselves as the delegate
// you could also instantiate the window directly in the nib and hook up the delegate
// simply call showWindow or setMediaType if you want to change the list of compression options shown
mCompressionOptionsWindow = [[QTCompressionOptionsWindow alloc] initWithMediaType:[[[mCaptureMovieFileOutput connections] lastObject] mediaType]];
if (nil == mCompressionOptionsWindow) {
    NSLog(@"Compression Options Window did not load!\n");
    return;
}
[mCompressionOptionsWindow setDelegate:self];

Can someone explain me what it's the author trying to explain

"you could instantiate the window directly in the nib"

?. He does have a nib with the QTCompressionOptionsWindow

Thanks for your replies


The purpose of the MyController-class in this sample is to simply illustrate how to use the QTCompressionOptionsWindow-class -- especially, how to set up the delegate-relationship.

In the MyController sample, the author chose to set this relationship up in the code snippet you posted.

The comment simply states that, if you don't want to do that programmatically, you could instead use IB for this purpose: simply create an instance (== instantiate) of the QTCompressionOptionsWindow-class in the NIB where you put your own controller and connect its "delegate" outlet to your controller.

If that sounds all jibberish to you, have a look at the sections "Controller Objects" and "Creating and Managing Outlet and Action Connections" of the "Interface Builder User Guide". Although I find them a little sparsely illustrated (given the target audience), they are quite good.


A technical note was written back in 2008 that discusses how to manage QTCompressionOptions in QTKit Capture and talks about the QTCompressionOptionsWindow sample in depth.

Technical Note 2219 "Managing QTCompressionOptions - An overview of the QTCompressionOptionsWindow sample"

http://developer.apple.com/library/mac/#technotes/tn2008/tn2219.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜