macOS/iOS API解説

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

目次

frameAutosaveName

INDEX>AppKit> NSWindow

フレームの自動保存名を返します

Objective-C

- (NSString *)frameAutosaveName

Swift

func frameAutosaveName() -> String?

解説

フレームの自動保存名を返します

返り値

Objective-C

(NSString *)

Swift

String?

引数

なし

フレームワーク

ApplicationKit

クラス

NSWindow

使用可能

10.0-

参照

関連記事(外部サイト)

例文

Objective-C

Swift

    //NSWindow saveFrameUsingName
    //NSWindow setFrameUsingName
    //NSWindow frameAutosaveName()
    //NSWindow setFrameAutosaveName()
    //NSWindow removeFrameUsingName
    func buttonAction078_save(sender: AnyObject){
        var aWindow : NSWindow = (sender as NSButton).window!
        aWindow.setFrameAutosaveName("")//自動保存中止
        //NSWindow.removeFrameUsingName("window078")
        aWindow.saveFrameUsingName("window078")
        aWindow.title = "フレームを保存しました"
    }
    func buttonAction078_set(sender: AnyObject){
        var aWindow : NSWindow = (sender as NSButton).window!
        if (aWindow.setFrameUsingName("window078")){
            aWindow.title = "保存したフレームにしました"
        }else{
            aWindow.title = "保存なし"
        }
    }
    func buttonAction078_auto(sender: AnyObject){
        var aWindow : NSWindow = (sender as NSButton).window!
        aWindow.setFrameAutosaveName("window078")
        aWindow.title = "自動保存"
        NSLog("frameAutosaveName %@", aWindow.frameAutosaveName()!)
    }
    func buttonAction078_remove(sender: AnyObject){
        var aWindow : NSWindow = (sender as NSButton).window!
        NSWindow.removeFrameUsingName("window078")
        aWindow.title = "フレームを保存をクリア"
    }
    @IBAction func function078(sender: AnyObject) {
        var theWindow : MyWindow078 = MyWindow078(contentRect: NSMakeRect(0.0, 0.0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false)
        windowArray.addObject(theWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄
        
        theWindow.center()//ウインドウをスクリーンの中心に
        theWindow.title = "フレーム未保存"//タイトル設定
        theWindow.orderFront(self)//前面に
        theWindow.makeKeyAndOrderFront(self)//表示
        theWindow.delegate = theWindow
        //ボタンを作成
        var theButton1 : NSButton = NSButton(frame: NSMakeRect(0.0, 2.0, 70.0, 30.0))
        theButton1.title = "Save"
        theButton1.bezelStyle = NSBezelStyle.RoundedBezelStyle
        theButton1.action = Selector("buttonAction078_save:")
        theButton1.target = self
        theWindow.contentView.addSubview(theButton1)
        
        //ボタンを作成
        var theButton2 : NSButton = NSButton(frame: NSMakeRect(70.0, 2.0, 70.0, 30.0))
        theButton2.title = "Set"
        theButton2.bezelStyle = NSBezelStyle.RoundedBezelStyle
        theButton2.action = Selector("buttonAction078_set:")
        theButton2.target = self
        theWindow.contentView.addSubview(theButton2)
        
        //ボタンを作成
        var theButton3 : NSButton = NSButton(frame: NSMakeRect(140.0, 2.0, 70.0, 30.0))
        theButton3.title = "auto"
        theButton3.bezelStyle = NSBezelStyle.RoundedBezelStyle
        theButton3.action = Selector("buttonAction078_auto:")
        theButton3.target = self
        theWindow.contentView.addSubview(theButton3)
        
        //ボタンを作成
        var theButton4 : NSButton = NSButton(frame: NSMakeRect(210.0, 2.0, 70.0, 30.0))
        theButton4.title = "remove"
        theButton4.bezelStyle = NSBezelStyle.RoundedBezelStyle
        theButton4.action = Selector("buttonAction078_remove:")
        theButton4.target = self
        theWindow.contentView.addSubview(theButton4)
        
    }

更新時バージョン