Created
November 13, 2012 07:59
-
-
Save ChrisRisner/4064576 to your computer and use it in GitHub Desktop.
ios day 15-2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)tappedSendFacebook:(id)sender { | |
SLComposeViewController *socialComposerSheet; | |
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { | |
socialComposerSheet = [[SLComposeViewController alloc] init]; | |
socialComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; | |
[socialComposerSheet setInitialText:[NSString stringWithFormat:@"My Tweet!",socialComposerSheet.serviceType]]; | |
[self presentViewController:socialComposerSheet animated:YES completion:nil]; | |
} | |
[socialComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) { | |
NSString *output; | |
switch (result) { | |
case SLComposeViewControllerResultDone: | |
//post worked | |
break; | |
case SLComposeViewControllerResultCancelled: | |
//cancelled | |
break; | |
} | |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; | |
[alert show]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment