macOS/iOS API解説

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

目次

NSNibクラス

INDEX>AppKit>

**

継承 NSObject
準拠 NSObject (NSObject)
フレームワーク /System/Library/Frameworks/AppKit.framework
使用可能 OS X 0.0以降
定義
インポート文 @import AppKit;

概要

メソッドとプロパティ

**

定数

参照

*

var windowArray : NSMutableArray = []   //ウインドウ保持用
    
    @IBAction func function001(sender: AnyObject) {
        if (windowArray.count == 0 ) {
            let nib : NSNib = NSNib(nibNamed: "NewWindow", bundle: NSBundle.mainBundle() )!
            //var topLevelArray : NSArray = []
            var topLevelArray = NSMutableArray()
            let outputValue = AutoreleasingUnsafeMutablePointer<NSArray?>(&topLevelArray)
         
            //NSBundle.mainBundle().loadNibNamed("NewWindow", owner: nil, topLevelObjects: outputValue)
            if let result : Bool = nib.instantiateWithOwner(self, topLevelObjects: outputValue) where result {
                for name in topLevelArray {
                    if ((name as! NSObject).className == NSWindow.className() ){
                        NSLog("%@",name.description)
                        NSLog("%@",(name as! NSWindow).title)
                        
                        let theWindow : NSWindow = (name as! NSWindow)
                        windowArray.addObject(theWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄
                        
                        (name as! NSWindow).makeKeyAndOrderFront(self)
                        (name as! NSWindow).orderFront(self)//前面に
                        //(name as! NSWindow).makeKeyAndOrderFront(self)//表示
                    }
                }
            }
            outputValue.memory = nil
        }
    }

更新時バージョン

OS X 10.11