macOS/iOS API解説

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

目次

maxSize

INDEX>AppKit> NSWindow

ウインドウフレームの最大値

Objective-C

@property NSSize maxSize

Swift

var maxSize: NSSize

解説

ウインドウフレームの最大値

設定値

最大サイズ
Objective-C

@property NSSize maxSize

Swift

var maxSize: NSSize

フレームワーク

ApplicationKit

クラス

NSWindow

使用可能

10.0

参照

- setMaxSize:
- minSize
- aspectRatio
- resizeIncrements

更新時のバージョン

OS X 10.10

関連記事(外部サイト)

例文

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{
    NSSize windowSize;
    windowSize = [myWindow maxSize];
    [info setStringValue:[NSString stringWithFormat:@"%.1f,%.1f",windowSize.width,windowSize.height]];
    }
@end

Swift

    //NSWindow maxSize
    func buttonAction060(sender: AnyObject){
        var theWindow : NSWindow = (sender as NSButton).window!
        //ウインドウの最大サイズを(400.0,300.0)にする
        theWindow.maxSize = NSMakeSize(400.0,300.0)
    }
    @IBAction func function060(sender: AnyObject) {
        var aWindow : NSWindow = NSWindow(contentRect: NSMakeRect(0.0, 0.0, 300, 200),
            styleMask:  NSTitledWindowMask |
                NSClosableWindowMask |
                NSMiniaturizableWindowMask |
            NSResizableWindowMask,
            backing:    .Buffered,
            defer:      false)
        windowArray.addObject(aWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄
        
        //ボタンを作成
        var theButton : NSButton = NSButton(frame: NSMakeRect(100.0, 2.0, 100.0, 30.0))
        theButton.title = "set"
        theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle
        theButton.action = Selector("buttonAction060:")
        theButton.target = self
        aWindow.contentView.addSubview(theButton)
        
        //ウインドウの表示
        aWindow.center()//ウインドウをスクリーンの中心に
        aWindow.title = "ウインドウタイトル"//タイトル設定
        aWindow.orderFront(self)//前面に
        aWindow.makeKeyAndOrderFront(self)//表示
    }