- 2010-01-17 (日) 16:13
- Object-C | iPhone | iPhone SDK 3
AlertBoxAppDelegate.h
#import <UIKit/UIKit.h>
@class AlertBoxViewController;
@interface AlertBoxAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
AlertBoxViewController *viewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet AlertBoxViewController *viewController;
@end
AlertBoxViewController.h
#import <UIKit/UIKit.h>
@interface AlertBoxViewController : UIViewController {
}
- (IBAction) displayView:(id) sender;
@end
AlertBoxViewController.m
//アラートボックスを表示するdisplayViewメソッド
-(IBAction) displayView:(id) sender{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"アラート画面"
message:@"ボタンを押しました"
delegate:self
cancelButtonTitle:@"閉じる"
otherButtonTitles:nil];
[alert show];
[alert release];
}
後は、InterfaceBuilderで、Alertを表示させるトリガーのボタンと、
File’s OwnerをCtrl+ドラッグで結んで、「displayView」を結びます。
- Newer: Androidアプリ、エミュレータのスキンを変更する
- Older: Object-C 基礎の基礎のメモ。クラス宣言
Comments:1
- Truden 10-01-18 (月) 20:00
-
Interesting, I`ll quote it on my site later.
[url=http://www.vapority.com/]Truden[/url]
Trackbacks:0
- Trackback URL for this entry
- http://splitchin.com/tech/2010/01/17/iphone%e3%82%a2%e3%83%97%e3%83%aa%e3%80%80%e3%82%a2%e3%83%a9%e3%83%bc%e3%83%88%e3%83%9c%e3%83%83%e3%82%af%e3%82%b9%e3%82%92%e8%a1%a8%e7%a4%ba%e3%81%99%e3%82%8b%e3%80%82/trackback/
- Listed below are links to weblogs that reference
- iPhoneアプリ アラートボックスを表示する。 from あらびき林檎。
