Share on Google+Share on Google+

Ravi Vora
how to do actionsheet in iphone?-RV
1 Answer(s)      5 years and 3 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];

Ads

View Answers

January 9, 2012 at 1:11 PM


??










Tutorials   
Java Spring Hibernate Struts Training How to uninstall old version of Android Studio? How to install cocoapods in Max? item lookup How to get path of a file in iOS? [NSConcreteMutableData release]: message sent to deallocated instance Covert Bool to String - NSString Getting UIButton by Tag How to write Example code for comparing Strings in iPhone SDK? How to set placeholder in uitextfield programmatically? Example code of adding placeholder in UItextFeild how to get UIView by tag J2me image use ase smiley UILineBreakModeWordWrap is deprecated Framework for Mobile Applications How to print UIButton id System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h' has been modified since the precompiled header UINavigationController Navigating to back uinavigationcontroller add right button UINavigationController how to set title uitextfield hide keyboard on return dismissmodalviewcontrolleranimated first deprecated in ios 6.0 xcode 6.1.1 download How to remove virtual keypad from apps java How to remove virtual keypad from apps java How to remove virtual keypad from apps java code to send sms alerts using jsp online iphone app development how to devlop mobile application? What is WAP? download mp3 file on server in iphone home button macbook pro keyboard calling from iphone through programitically in iphone How to retrieve a field from SQLite to Edittext in android How to retrieve a field from SQLite to Edittext in android Sqlite3 Why NSMutableDictionary ios work with nsdictionary what is class methods in objective c what is class methods in objective c UIButton HOW TO FIND OUT GPS COORDINATES WITHOUT USING ONLINE DATABASE OR OTHERTHING ON MOBILE HOW TO FIND OUT GPS COORDINATES WITHOUT USING ONLINE DATABASE OR OTHERTHING ON MOBILE HOW TO FIND OUT GPS COORDINATES WITHOUT USING ONLINE DATABASE OR OTHERTHING ON MOBILE Rad Calculator ANDROID J2ME Bar graph j2me image application iphone iphone

Ads

 
Advertisement null

Ads