NSAlert:addButtonWithTitle:
Home 目次>ApplicationKit>NSAlert
10.3

addButtonWithTitle:

アラートウインドウにボタンを追加します


-(NSButton *) addButtonWithTitle:(NSString *)aTitle


【返り値】
   NSButton *追加したボタン
【パラメータ】
   aTitle追加するボタンのタイトル


【解説】

アラートウインドウにボタンを追加します。



【例文】


#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


(C) 2000-2007 Satoshi Oomori.
[Apple]

Google
Webwww.oomori.com
Apple_Store_40x120

[ad:Usual day in Japan]

この記事を評価してください。 

良い 

間違いがある 説明がわかりにくい 例文がわかりにくい  

Home 目次>ApplicationKit>NSAlert
修正日2007.5.28