NSAlert:alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:
Home 目次>ApplicationKit>NSAlert
10.3

alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:

NSAlertのインスタンスを作ります


+(NSAlert *) alertWithMessageText:(NSString *)messageTitle
   defaultButton:(NSString *)defaultButtonTitle
   alternateButton:(NSString *)alternateButtonTitle
   otherButton:(NSString *)otherButtonTitle
   informativeTextWithFormat:(NSString *)format, ...


【返り値】
   NSAlert *作ったアタートパネル
【パラメータ】
   messageTitleタイトル
   defaultButtonTitleデフォルトのボタンタイトル
   alternateButtonTitle代理ボタンタイトル
   otherButtonTitleその他のボタンタイトル
   format, ... 表示する文字列


【解説】

NSAlertのインスタンスを作ります。
アラートパネルを閉じるときの処理として
- ( void )alertDidEnd:(NSAlert *)alert returnCode:( int )returnCode contextInfo:( void *)contextInfo; を実装します。



【例文】


#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


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

Google
Webwww.oomori.com
Apple_Store_40x120

[ad:Usual day in Japan]

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

良い 

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

Home 目次>ApplicationKit>NSAlert
修正日2007.5.28