addButtonWithTitle:
アラートウインドウにボタンを追加します
-(NSButton *)addButtonWithTitle:(NSString *)aTitle:
解説
アラートウインドウにボタンを追加します。
返り値
( NSButton * )
追加したボタン
引数
( NSString * )aTitle
追加するボタンのタイトル
フレームワーク
ApplicationKit
クラス
NSAlert
Instance Methods
使用可能
10.3
参照
-buttons
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //アラートパネルを作る NSAlert *alert = [NSAlert alertWithMessageText:@"alertWithMessageText" defaultButton:@"defaultButton" alternateButton:@"alternateButton" otherButton:@"otherButton" informativeTextWithFormat:@"informativeTextWithFormat %@",@"text" ]; //ボタンを追加する [alert addButtonWithTitle:@"add"]; //シートで表示 [alert beginSheetModalForWindow:[sender window] modalDelegate:self didEndSelector:@selector(endAlert) contextInfo:nil ]; } //終わった後の処理 -(void)endAlert { NSLog(@"end"); } @end