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
}
}];
精彩评论