macOS/iOS API解説

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

目次

initWithFrame:pullsDown:

NSPopUpButtonを初期化して返します
-(id)initWithFrame:(NSRect)frameRect:
         pullsDown:(BOOL)flag:

解説

ポップアップボタン(NSPopUpButton)を作って初期化して返します。
ボタンの大きさはframeRectで決めます。
flagをYESにするとプルダウンメニューになります。

返り値

( id )

ポップアップボタン

引数

( NSRect )frameRect

ボタンの範囲

( BOOL )flag

プルダウンメニューか?

フレームワーク

ApplicationKit

クラス

NSPopUpButton

Instance Methods

使用可能

10.0

参照

- pullsDown
- setPullsDown:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
//myOutletはポップアップボタン
//menuは別のメニュー
NSPopUpButton *pButton = [[[NSPopUpButton alloc] initWithFrame:NSMakeRect(30.0, 80.0, 150.0, 22.0)
                        pullsDown:NO
                        ] autorelease];
            [[[sender window] contentView] addSubview:pButton];
[pButton setMenu:menu];

}

@end