Created
October 24, 2011 04:49
-
-
Save sumardi/1308394 to your computer and use it in GitHub Desktop.
Twitter framework
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
| #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