O'Reilly logo

Xcode 4 Cookbook by Steven F. Daniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding photos to a tweet

In this recipe, we will learn how we can incorporate images within Twitter messages.

Getting ready

In this recipe, we will look at how we can add an image to a tweet using the Twitter composition sheet.

How to do it…

Adding images to a Twitter message is very easy and can be achieved by performing the following simple steps inside the TwitterExample project:

  1. Open the ViewController.m implementation file from the project navigator.
  2. Next, modify the composeTweet method and add the highlighted code within the following code snippet:
    - (IBAction) composeTweet: (UIButton *) sender {
    
    // Attach an image to our Tweet
    TWTweetComposeViewController *myTwitter =
       [[TWTweetComposeViewController alloc] init];
    
    [myTwitter addImage:[UIImage imageNamed:@"Blue-Aqua- ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required