Action Sheet in IOS


                               Action Sheet For Iphone

Drag Labels and buttons
i ) Insert headings for some Labels and for other Labels map the Sliders.
ii) There is no need to change Main.m,  AppDelgate.h, AppDelegate.m ..

ViewController.h


#import <UIKit/UIKit.h>


@interface ViewController : UIViewController<UIActionSheetDelegate>{
  IBOutlet UILabel *lbl;  
}
-(IBAction)showAction;
@end

ViewController.m

#import "ViewController.h"

@implementation ViewController
-(IBAction)showAction
{
    UIActionSheet *action=[[UIActionSheet alloc]initWithTitle:@"Action" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:@"ok" otherButtonTitles:@"gmail", nil];
    [action showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    
    if (buttonIndex ==0) {
        lbl.text=@"Thanks";
    }
    if (buttonIndex ==1) {
        NSURL *url=[NSURL URLWithString:@"http://www.iosbricks.blogspot.com"];
        [[UIApplication sharedApplication]openURL:url]; 
    }
}


@end





tags: iphone sample codes, iphone sample projects, sample apps for iphone with source code, sample programs in iphone, 

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Blogger Templates