Skip to content

Instantly share code, notes, and snippets.

@sumardi
Created October 24, 2011 04:49
Show Gist options
  • Select an option

  • Save sumardi/1308394 to your computer and use it in GitHub Desktop.

Select an option

Save sumardi/1308394 to your computer and use it in GitHub Desktop.
Twitter framework
#import <Twitter/Twitter.h>
- (IBAction)tweetButtonTapped:(id)sender
{
TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];
[twitter addURL:[NSURL URLWithString:@"http://www.sumardi.net"];
[twitter setInitialText:@"Checkout my blog"];
[self presentModalViewController:twitter animated:YES];
twitter.completionHandler = ^(TWTweetComposeViewControllerResult result)
{
NSString *title = @"Tweet Status";
NSString *msg;
if (result == TWTweetComposeViewControllerResultCancelled)
msg = @"Tweet compostion was canceled.";
else if (result == TWTweetComposeViewControllerResultDone)
msg = @"Tweet composition completed.";
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[alertView show];
[self dismissModalViewControllerAnimated:YES];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment