Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Mobile-Applications how to do actionsheet in iphone?-RV
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ravi Vora
how to do actionsheet in iphone?-RV
1 Answer(s)      2 years and 9 months ago
Posted in : MobileApplications


-(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];

Advertisement
View Answers

January 9, 2012 at 1:11 PM


??



Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com