1
我的應用程序中有以下保存面板。我最近嘗試過沙盒,但不幸的是,當沙盒保存似乎沒有工作。沙盒時NSSavePanel不工作? - OSX•Objective C
我明白beginSheetForDirectory折舊,所以可能這就是爲什麼它不工作?我如何才能使用沙箱工作?
- (IBAction)saveButtonPressed:(id)sender
{
NSSavePanel *sp = [NSSavePanel savePanel];
[sp setRequiredFileType:@"jpg"];
[sp beginSheetForDirectory:[NSString stringWithFormat:@"%@/Pictures", NSHomeDirectory()]
file:@"output.jpg"
modalForWindow:window
modalDelegate:self
didEndSelector:@selector(didEndSaveSheet:returnCode:conextInfo:)
contextInfo:nil];
}
-(void)didEndSaveSheet:(NSSavePanel *)savePanel
returnCode:(int)returnCode conextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton)
{
self.baseFilename = [[savePanel filename] stringByDeletingPathExtension];
tileHeight = [heightTextField intValue];
tileWidth = [widthTextField intValue];
[self performSelector:@selector(delayPresentSheet) withObject:nil afterDelay:0.1];
}
}