alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:
NSAlertのインスタンスを作ります
+(NSAlert *)alertWithMessageText:(NSString *)messageTitle:
defaultButton:(NSString *)defaultButtonTitle:
alternateButton:(NSString *)alternateButtonTitle:
otherButton:(NSString *)otherButtonTitle:
informativeTextWithFormat:(NSString *)format, ... :
解説
NSAlertのインスタンスを作ります。
アラートパネルを閉じるときの処理として- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo;を実装します。
返り値
( NSAlert * )
作ったアラートパネル
引数
( NSString * )messageTitle
タイトル
( NSString * )defaultButtonTitle
デフォルトのボタンタイトル
( NSString * )alternateButtonTitle
代理ボタンタイトル
( NSString * )otherButtonTitle
その他のボタンタイトル
( NSString * )format, ...
表示する文字列
フレームワーク
ApplicationKit
クラス
NSAlert
Class Methods
使用可能
10.3
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //NSAlertのインスタンスを作ります。 NSAlert *alert = [NSAlert alertWithMessageText:@"alertWithMessageText" defaultButton:@"defaultButton" alternateButton:@"alternateButton" otherButton:@"otherButton" informativeTextWithFormat:@"informativeTextWithFormat %@",@"text" ]; //表示します、 [alert beginSheetModalForWindow:[sender window] modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil ]; } //閉じる時の処理 - (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo; { NSLog(@"end"); } @end