Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 08-26-2008, 01:59 AM   #3 (permalink)
Stitch
Registered Member
 
Stitch's Avatar
 
Join Date: Aug 2008
Posts: 401
Default

This is taken from the UICatalog sample code.

Insure your header file contains the following:

Code:
@interface YourViewController : UIViewController <UIAlertViewDelegate>
Then just add the following in the class you need the alert:

Code:
- (void)alertOKCancelAction {
  // open a alert with an OK and cancel button
  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
  [alert show];
  [alert release];
}
and
Code:
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
  // the user clicked one of the OK/Cancel buttons
  if (buttonIndex == 0)
  {
    NSLog(@"ok");
  }
  else
  {
    NSLog(@"cancel");
  }
}
Stitch is offline   Reply With Quote
 

» Advertisements
» Online Users: 780
21 members and 759 guests
annchavez78, at0m87, dfvdan, Domele, elhanche, ghz.rai, gladlard24, Gurpartap Singh, HerbertMIbarra, ilmman, Macaret, Meoz, nidie, oztemel, phackdat, ratheesh, smethorst, socbaybot, soonw29, Tambourin, twerner
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,822
Threads: 89,206
Posts: 380,635
Top Poster: BrianSlick (7,129)
Welcome to our newest member, gladlard24
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:29 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.