开发者

beginSheetForDirectory ... Deprecated

开发者 https://www.devze.com 2023-03-24 17:49 出处:网络
I have following code which works fine, however when I updated to Lion I started getting warnings that this method has been deprecated and suggests that I use \"beginSheetModalforWindow\".How would yo

I have following code which works fine, however when I updated to Lion I started getting warnings that this method has been deprecated and suggests that I use "beginSheetModalforWindow". How would you translate the following to code to use that?

[savePanel beginSheetForDirectory: NULL
                        开发者_高级运维         file: fileName
                       modalForWindow: mWindow
                        modalDelegate: self
                       didEndSelector: @selector(savePanelDidEnd:returnCode:contextInfo:) 
                          contextInfo: NULL];


It's actually beginSheetModalForWindow:completionHandler:, and you'd do something like this:

[savePanel setNameFieldStringValue:fileName];
[savePanel beginSheetModelForWindow:mWindow completionHandler:^(NSInteger result) {
    if (result == NSFileHandlingPanelOKButton) {
        // do the save
    }
}];
0

精彩评论

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