macOS/iOS API解説

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

目次

contentMinSize

INDEX>AppKit> NSWindow

ウインドウの内容の最小サイズ

Objective-C

@property NSSize contentMinSize

Swift

var contentMinSize: NSSize

解説

ウインドウのコンテンツの最小サイズ

設定値

Objective-C

@property NSSize contentMinSize

Swift

var contentMinSize: NSSize

最小サイズ

フレームワーク

ApplicationKit

クラス

NSWindow

使用可能

10.3

参照

-setContentMinSize:
-contentMaxSize

更新時のバージョン

OS X 10.10

関連記事(外部サイト)

例文

Objective-C

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{


[myWindow setContentMinSize:NSMakeSize(500.0,500.0)];

NSLog([NSString stringWithFormat:@"%.1f",[myWindow contentMinSize].width]);
}
@end

Swift

    //NSWindow contentMinSize
    func buttonAction070(sender: AnyObject){
        var aWindow : NSWindow = (sender as NSButton).window!
        
        aWindow.contentMinSize = NSMakeSize(200.0, 100.0)
    }
    @IBAction func function070(sender: AnyObject) {
        var theWindow : NSWindow = NSWindow(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)//表示
        
        
        //ボタンを作成
        var theButton : NSButton = NSButton(frame: NSMakeRect(100.0, 2.0, 100.0, 30.0))
        theButton.title = "Action"
        theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle
        theButton.action = Selector("buttonAction070:")
        theButton.target = self
        theWindow.contentView.addSubview(theButton)
        
        
        NSLog("x = %.2f,y = %.2f,w = %.2f,h = %.2f", Float(theWindow.frame.origin.x ),
            Float(theWindow.frame.origin.y),
            Float(theWindow.frame.size.width),
            Float(theWindow.frame.size.height))
    }