macOS/iOS API解説

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

目次

windowWithWindowNumber:

INDEX>AppKit>NSApplication

指定したウインドウ番号のウインドウオブジェクトを返します
- (NSWindow *)windowWithWindowNumber:(NSInteger)windowNum
func windowWithWindowNumber(_ windowNum: Int) -> NSWindow?

解説

指定したウインドウ番号(windowNum)のウインドウオブジェクト(NSWindow)を返します。

返り値

( NSWindow * )

Swift

NSWindow

ウインドウ

引数

( NSInteger )windowNum

ウインドウ番号

フレームワーク

ApplicationKit

クラス

NSApplication

使用可能

10.0

編集時のバージョン

10.10

参照

例文

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{
	
	NSLog ([[[NSApplication sharedApplication] windowWithWindowNumber:[myWindow windowNumber]] description]);
	
}
@end

Swift

//NSApplication windowWithWindowNumber()
    @IBAction func function027(sender: AnyObject) {
        //共有アプリケーションインスタンスを取得
        let anApplication = MyApplication.sharedApplication()
        let mainWindow :NSWindow = anApplication.mainWindow!
        NSLog("window number = %d",anApplication.windowWithWindowNumber(mainWindow.windowNumber)!)
    }