how to do actionsheet in iphone?-RV

how to do actionsheet in iphone?-RV

-(IBAction)buttonClicked
{
    UIActionSheet *asheet = [[UIActionSheet alloc] initWithTitle:@"Share With" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Facebook",@"Twitter",@"Mail",@"SMS", nil];
    asheet.actionSheetStyle=UIActionSheetStyleBlackTranslucent;
    [asheet showInView:[self.view superview]]; //note: in most cases this would be just self.view, but because I was doing this in a tabBar Application, I use the superview.
    [asheet setFrame:CGRectMake(0, 160, 320, 320)];
    [asheet release];

    subviews = [asheet subviews];
    [[subviews objectAtIndex:1] setFrame:CGRectMake(20, 40, 280, 46)]; 

    [[subviews objectAtIndex:2] setFrame:CGRectMake(20, 95, 280, 46)]; 

    [[subviews objectAtIndex:3] setFrame:CGRectMake(20, 150, 280, 46)]; 
    [[subviews objectAtIndex:4] setFrame:CGRectMake(20, 205, 280, 46)]; 

    }



- (void)actionSheet:(UIActionSheet *)actionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == actionSheet.cancelButtonIndex) { return; }
    switch (buttonIndex) {
        case 0:
        {
            if(appDel.flagreach==1)
            {
                UIAlertView *myAlert = [[[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"This app require an internet connection via WiFi or cellular network to work." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil] autorelease];
                [myAlert show];
            }
            else {
                [self postGradesTapped:nil];
            }
            NSLog(@"Item A Selected");
            break;
        }
        case 1:
        {
            if(appDel.flagreach==1)
            {
                UIAlertView *myAlert = [[[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"This app require an internet connection via WiFi or cellular network to work." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil] autorelease];
                [myAlert show];
            }
            else {
                if(!_engine){  
                    _engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self];  
                    _engine.consumerKey    = kOAuthConsumerKey;  
                    _engine.consumerSecret = kOAuthConsumerSecret;  
                }  

                if(![_engine isAuthorized]){  
                    UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:_engine delegate:self];  

                    if (controller){  
                        [self presentModalViewController: controller animated: YES]; 
                    }
                }
                else {
                    NSString *name=[sharearray objectAtIndex:Position/320];
                    [_engine sendUpdate:name];
                    [_engine getFollowedTimelineSinceID:1 startingAtPage:1 count:100];
                }
            }

            NSLog(@"Item B Selected");
            break;
        }
        case 2:
        {
            if(appDel.flagreach==1)
            {
                UIAlertView *myAlert = [[[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"This app require an internet connection via WiFi or cellular network to work." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil] autorelease];
                [myAlert show];
            }
            else {
                MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];

                mailController.mailComposeDelegate = self;

                [mailController setSubject:@"Quotes Pro..."];
                NSString *name=[sharearray objectAtIndex:Position/320];
                //[mailController setMessageBody:@"This is the MailSend Application?." isHTML:NO];
                [mailController setMessageBody:name isHTML:NO];

                [self presentModalViewController:mailController animated:YES];

                [mailController release];
            }
            NSLog(@"Item C Selected");
            break;
        }
        case 3:
        {
            [self showSMSPicker];
View Answers

January 9, 2012 at 1:11 PM

??









Related Tutorials/Questions & Answers:
how to do actionsheet in iphone?-RV
how to do this?
Advertisements
How do you do data mining projects?
How to do url rewritting?
how to do this - JavaMail
how to do gui
How do you define a constant?
How do I upgrade mysql?
How do you sum a dictionary
How do i do the coding for 'leaving a comment' in java
How can I do it? .click();
How do I do this program? I'm new to Java programming...
how do i solve this problem?
how do i solve this question?
How do you call a constructor for a parent class?
How do you pass a variable by value?
How do I decompile Java class files?
How do I initialize a byte array in Java?
How do I compare strings in Java?
how to do map in iphone?-RV
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
HOW TO I CHANGE THE SWITCH TO IF ELSE OR DO WHILE OR WHILE DO FOR THIS CODING
How do we create session factory in hibernate?
How do I compile the registration form?
How do we create custom component
how to do abstraction for insurance policy being issued...
How to do Static Resources Configuration in Spring MVC?
How do I get started with Bootstrap
How do you add a numerical value to a regex
How do SEL and @selector work in iphone sdk?
How do I get started with Bootstrap
HOW TO DO WEBSITE INTERFACE FOR JAVA MODULE
How do I learn Spring Framework?
How do I learn Spring Framework?
How do I learn Spring Framework?
how do you parse by reference in java(with JGrasp)
How do I generate random number?
How do I study big data?
How do beginners learn about Java?
How do I learn Spring Framework?
How do I learn Spring Framework?
How do I download urllib3 for python 2.7
How do I start learning MongoDB?
how do i begin a two dimensional array?
How do I start learning AI?
How do I become an AI engineer?
How do I become a data scientist in 2020?
How do I become a python master?

Ads