loadNibFile:externalNameTable:withZone:
ファイル名で指示したNibファイルをロードします
+(BOOL)loadNibFile:(NSString *)fileName: externalNameTable:(NSDictionary *)context: withZone:(NSZone *)zone:
解説
ファイル名で指示したNibファイルをロードします。
返り値
( BOOL )
YES/NO
引数
( NSString * )fileName
ファイル名
( NSDictionary * )context
( NSZone * )zone
ゾーン
フレームワーク
ApplicationKit
クラス
NSBundleAdditions
Class Methods
使用可能
10.0
参照
例文
#import "SetImage.h" @implementation SetImage - (IBAction)set:(id)sender { //開けるファイル拡張子の配列 NSArray *fileTypes = [ NSArray arrayWithObject : @"nib" ]; //OpenPanelを作る NSOpenPanel *opPanel = [ NSOpenPanel openPanel ]; //OpenPanelの結果のボタン番号 int opRet; NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys: self,@"NSOwner",nil]; //OpenPanelでファイル選択 opRet = [ opPanel runModalForDirectory : NSHomeDirectory() //どこのディレクトリを出すか file : @"Pictures" //どのどのファイルを選択しておくか types : fileTypes ];//選べるファイルタイプ if ( opRet == NSOKButton ) { // OPENPanelのボタンがOKなら if ([NSBundle loadNibFile:[ opPanel filename ] externalNameTable:dic withZone:[self zone]]){ NSLog(@"YES"); }else{ NSLog(@"NO"); } } } @end