0

I have a button at the end of a guide that says Done!I need it to bring up Facebook posting dialogue and also segue back to the menu screen

At the moment I have it opening a Facebook posting screen, which pops up and goes back down when you click post or cancel. I would like it to return to the menu after the facebook process has completed. I have followed a guide on how segue programatically and have added the code to my current postToFacebook IBAction but it didn't work. I then tried to create it's own IBAction and link it to the button but it didnt work either. Does anyone know how I can get it to segue after the Facebook dialogue Heres my code for facebook posting in case you need it

- (IBAction)PostToFacebook:(id)sender {
mySLComposerSheet = [[SLComposeViewController alloc] init];
mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[mySLComposerSheet setInitialText:@"I just followed a guide on this App - Get it on the App Store http://"];
[self presentViewController:mySLComposerSheet animated:YES completion:nil];
}

And heres the code for the programatic segue

-(IBAction)nextView{
[self performSegueWithIdentifier:@"next" sender:self];   }
4

2 に答える 2

0

編集済み:

   - (IBAction)facebook:(id)sender {


    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
        SLComposeViewController *facebook = [[SLComposeViewController alloc]init];

        facebook = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
        [facebook setInitialText:[NSString stringWithFormat:@"your string"]];
        [self presentViewController:facebook animated:YES completion:nil];

        [facebook setCompletionHandler:^(SLComposeViewControllerResult result){
            NSString *output;
            switch (result) {
                case SLComposeViewControllerResultCancelled:
                    // here you can handle your seque, or your custom action what you want
                    break;
                case SLComposeViewControllerResultDone:
                    // here you can handle your seque, or your custom action what you want
                    break;
                default:
                    break;
            }
            //            [self dismissViewControllerAnimated:YES completion:nil];

        }];
    }
    else{
        UIAlertView * alertView = [[UIAlertView alloc]initWithTitle:@"No Facebook Account" message:@"There are no Facebook accounts configured. You can configure or create accounts in settings ." delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
        [alertView show];
    }

}

私はそれが役立つことを願っています!

于 2013-09-10T08:33:52.187 に答える