alertWithError:
エラーオブジェクトでアラートオブジェクトを作って返します
+(NSAlert *)alertWithError:(NSError *)anError:
解説
エラーオブジェクトでアラートオブジェクトを作って返します。
返り値
( NSAlert * )
なし
引数
( NSError * )anError
フレームワーク
ApplicationKit
クラス
NSAlert
Class Methods
使用可能
10.4
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSError *error = [NSError errorWithDomain:@"NSOSStatusErrorDomain" code:-10 userInfo:[NSDictionary dictionary] ]; NSAlert *alert = [NSAlert alertWithError:error]; //表示します、 [alert beginSheetModalForWindow:[sender window] modalDelegate:self didEndSelector:@selector(endAlert) contextInfo:nil ]; } //閉じる時の処理 -(void)endAlert { NSLog(@"end"); } @end