2011年5月31日火曜日

XcodeでAlertButtonを作る





alertButtonViewController.h
#import <UIKit/UIKit.h>

@interface alertButtonViewController : UIViewController {

 
}

-(IBAction)alert;

@end



alertButtonViewController.m
#import "alertButtonViewController.h"

@implementation alertButtonViewController

-(IBAction)alert{

 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" 
             message:@"You touched me?" 
               delegate:nil 
            cancelButtonTitle:@"No I'm not" 
            otherButtonTitles:@"Yes I'm touched",nil];
 [alert show];
 [alert release];
}

- (void)didReceiveMemoryWarning {
 // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
 
 // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
 // Release any retained subviews of the main view.
 // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

@end

参考

YouTube - iPhone SDK Tutorial: UIAlert View (About Button)
http://www.youtube.com/watch?v=btT_ncFkYjw&hd=1

0 コメント: