How to create an advanced Twitter app for the iPhone/iPod Touch HD

16.12.2011
How to create a simple Twitter app for the iPhone/iPod Touch. Enjoy. CODE: .h -(IBAction)starttweet:(id)sender; .m #import "Twitter/Twitter.h" @implementation ViewController -(IBAction)starttweet:(id)sender { TWTweetComposeViewController *tweetController = [[TWTweetComposeViewController alloc]init]; NSString *initialstring = [NSString stringWithFormat:@"Hello Friends!"]; [tweetController setInitialText:initialstring]; UIImage *tweetImage = [UIImage imageNamed:@"Full name of your image"]; [tweetController addImage:tweetImage]; [tweetController addURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.apple.com"]]]; if ([TWTweetComposeViewController canSendTweet]) { [self presentModalViewController:tweetController animated:YES]; } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oopps!" message:@"Sorry, Tweet could not open!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil]; [alert show]; } tweetController.completionHandler = ^(TWTweetComposeViewControllerResult result) { if (result == TWTweetComposeViewControllerResultCancelled) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Tweet Canceled" message:@"Your Tweet was canceled!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil]; [alert show]; } [self dismissModalViewControllerAnimated:YES]; }; }

Похожие видео

Показать еще