| Home 目次>ApplicationKit>NSAlert | 10.4 |
alertWithError:
エラーオブジェクトでアラートオブジェクトを作って返します
+(NSAlert *) alertWithError:(NSError *)anError
【返り値】 | |
| NSAlert * | なし |
| 【パラメータ】 | |
| anError |
【解説】
エラーオブジェクトでアラートオブジェクトを作って返します。
【例文】
#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
![]() | |
この記事を評価してください。
| Home 目次>ApplicationKit>NSAlert | 修正日2007.5.28 |