Home > Tags > AlertBox

AlertBox

iPhoneアプリ アラートボックスを表示する。

安いインクをお探しですか?

iPhone AlertBox

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」を結びます。

Home > Tags > AlertBox

カテゴリー
RSS あらびき林檎
スポンサー

Return to page top