macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

setPrintPanel:

印刷パネルをセットします
-(void)setPrintPanel:(NSPrintPanel *)panel:

解説

印刷パネルをセットします。

返り値

( void )

なし

引数

( NSPrintPanel * )panel

フレームワーク

ApplicationKit

クラス

NSPrintOperation

Instance Methods

使用可能

10.0

参照

- accessoryView
- printPanel
- setAccessoryView:
- setShowPanels:
- showPanels

例文

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{
NSPrintPanel *pPanel = [NSPrintPanel printPanel];
NSPrintOperation *op = [NSPrintOperation printOperationWithView:[[sender window] contentView]];
NSPrintInfo *pInfo = [NSPrintInfo sharedPrintInfo] ;

[op setPrintInfo:pInfo];

[op setPrintPanel:pPanel];

[op setShowPanels:NO];
([op showPanels]) ? NSLog(@"YES") : NSLog(@"NO") ;

NSLog([[op printPanel] className]);

[pPanel beginSheetWithPrintInfo:[NSPrintInfo sharedPrintInfo]
                    modalForWindow:[sender window]
                    delegate:self
                    didEndSelector:@selector(didEndPrintSheet:returnCode:conextInfo:)
                    contextInfo:nil
                    ];
}

-(void)didEndPrintSheet:(NSSavePanel *)savePanel returnCode:(int)returnCode conextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton){
NSLog(@"YES");
}else{
NSLog(@"Cansel");
}
}
@end