0

Possible Duplicate:
iOS 5 Attach photo to Twitter with Twitter API

Some Twitter clients have a photo tweet feature. Does the iOS 5 Twitter API also include a way to tweet a photo?

Community
  • 1
  • 1
Proud Member
  • 39,470
  • 44
  • 145
  • 229
  • Have you taken a look here already? http://stackoverflow.com/questions/8129079/ios-5-attach-photo-to-twitter-with-twitter-api – Nicola Miotto Aug 27 '12 at 11:46

3 Answers3

2

Read this : TWTweetComposeViewController Class Reference and the - addImage property

Pierre
  • 8,487
  • 5
  • 49
  • 79
1

There is need to use TWTweetComposeViewController Class Reference

Refer ios-5-attach-photo-to-twitter-with-twitter-api link for code.

Community
  • 1
  • 1
Paresh Navadiya
  • 37,791
  • 11
  • 79
  • 130
1

Yes of course

if ([[[UIDevice currentDevice] systemVersion] floatValue] > 5.0) {
        // Create the view controller
        TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];

        // Optional: set an image, url and initial text
        [twitter addImage:[UIImage imageName:@"YourImage.png"]];
        [twitter setInitialText:@"I created this photo Download http://www.twetter.com"];

        // Show the controller
        [self presentModalViewController:twitter animated:YES];

        // Called when the tweet dialog has been closed
        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.";

            // Show alert to see how things went...
            UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
            [alertView show];

            // Dismiss the controller
            [self dismissModalViewControllerAnimated:YES];
        };
    }
Hiren
  • 12,632
  • 7
  • 53
  • 72