zoukankan      html  css  js  c++  java
  • Mac SavePanel 保存文件的GUI代码

    // Move the recorded temporary file to a user-specified location (视频文件另存储过程,依据用户选择的路径和文件保存名)
    		NSSavePanel *savePanel = [NSSavePanel savePanel];
    		[savePanel setAllowedFileTypes:[NSArray arrayWithObject:AVFileTypeQuickTimeMovie]];
    		[savePanel setCanSelectHiddenExtension:YES];
    		[savePanel beginSheetModalForWindow:[self windowForSheet] completionHandler:^(NSInteger result) {
    			NSError *error = nil;
    			if (result == NSOKButton) {
    				[[NSFileManager defaultManager] removeItemAtURL:[savePanel URL] error:nil]; // attempt to remove file at the desired save location before moving the recorded file to that location
    				if ([[NSFileManager defaultManager] moveItemAtURL:outputFileURL toURL:[savePanel URL] error:&error]) {
    					[[NSWorkspace sharedWorkspace] openURL:[savePanel URL]];
    				} else {
    					[savePanel orderOut:self];
    					[self presentError:error modalForWindow:[self windowForSheet] delegate:self didPresentSelector:@selector(didPresentErrorWithRecovery:contextInfo:) contextInfo:NULL];
    				}
    			} else {
    				// remove the temporary recording file if it's not being saved
    				[[NSFileManager defaultManager] removeItemAtURL:outputFileURL error:nil];
    			}
    		}];
    
    效果图:
    <img src="http://img.blog.csdn.net/20140807162831514?

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2h1YW55aXR1b2t1/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />


  • 相关阅读:
    (转)构建自己的AngularJS,第一部分:Scope和Digest
    使用CSS3 制作一个material-design 风格登录界面
    SS
    从零开始构建 Wijmo & Angular 2 小应用
    JavaScript使用构造函数获取变量的类型名
    Luogu-1527 [国家集训队]矩阵乘法
    Codeforces Round #525 (Div. 2)
    BZOJ-3879: SvT
    BZOJ-1396: 识别子串
    计算几何模板
  • 原文地址:https://www.cnblogs.com/wzzkaifa/p/6914239.html
Copyright © 2011-2022 走看看