macOS/iOS API解説

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

目次

convertScreenToBase:

INDEX>AppKit> NSWindow

スクリーンの座標位置をウインドウの座標位置に変換して返します

Objective-C

- (NSPoint)convertScreenToBase:(NSPoint)point

Swift
なし

解説

スクリーンの座標位置をウインドウの座標位置に変換して返します。

返り値

( NSPoint )

ウインドウの座標位置

引数

( NSPoint )aPoint

スクリーンの座標位置

フレームワーク

ApplicationKit

クラス

NSWindow

使用可能

10.0−10.7

例文

Objective-C

Swift

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{
NSPoint convertPoint;

convertPoint = [myWindow convertScreenToBase:NSMakePoint(0.0,0.0)];

[info setStringValue:[NSString stringWithFormat:@"%.1f,%.1f",convertPoint.x,convertPoint.y]];

}
@end

関連記事(外部サイト)

更新時のバージョン

OS X 10.10