addSubview:
ビューにサブビューを追加します
-(void)addSubview:(NSView *)aView:
解説
ビューにサブビュー(aView)を追加します。
追加したビューを次のレスポンダにします。レシーバーは追加したビューを保持する。
ビュー階層から追加したビューを削除するためにはremoveFromSuperviewを使う。
追加したビューを保持したいならremoveFromSuperviewを呼ぶ前にretainしなければいけない。
返り値
( void )
なし
引数
( NSView * )aView
追加するビュー
フレームワーク
ApplicationKit
クラス
NSView
Instance Methods
使用可能
10.0
参照
- addSubview:positioned:relativeTo:
- subviews
- removeFromSuperview
- setNextResponder: (NSResponder)
- viewWillMoveToSuperview:
- viewWillMoveToWindow:
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //開けるファイル拡張子の配列 //ボタンにImageをセット [scrollview addSubview : sender ];//scrollviewはScrollViewのサブクラスsenderはボタン } @end