开发者

beginSheetForDirectory ... Deprecated

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜