macOS/iOS API解説

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

目次

sizeForPaperName:

指定した用紙のサイズを返します
+(NSSize)sizeForPaperName:(NSString *)name:

解説

指定した用紙のサイズを返します。

返り値

( NSSize )

サイズ

引数

( NSString * )name

紙名

フレームワーク

ApplicationKit

クラス

NSPrintInfo

Class Methods

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSPrintInfo *pInfo = [NSPrintInfo sharedPrintInfo] ;
NSPageLayout *pageLayout = [NSPageLayout pageLayout];

[pageLayout beginSheetWithPrintInfo:pInfo
            modalForWindow:[sender window] 
            delegate:self 
            didEndSelector:@selector(didEndPageLayout) 
            contextInfo:nil ];
            
            NSLog([NSString stringWithFormat:@"w=%.1f,h=%.1f",[NSPrintInfo sizeForPaperName:@"A4"].width,[NSPrintInfo sizeForPaperName:@"A4"].height]);
}
-(void)didEndPageLayout
{
NSLog(@"close");
}

@end