iOS Developer Library

Developer

Twitter Framework Reference TWTweetComposeViewController Class Reference

Options
Deployment Target:

On This Page
Language:

TWTweetComposeViewController

The TWTweetComposeViewController class presents a view to the user to compose a tweet. More...

Inheritance


Import Statement


import Twitter @import Twitter;

Availability


Available in iOS 5.0 and later.
Deprecated in iOS 6.0.
  • Returns whether you can send a Twitter request.

    Declaration

    Objective-C

    + (BOOL)canSendTweet

    Return Value

    YEStrue if Twitter is accessible and at least one account is set up; otherwise NOfalse.

    Import Statement

    Availability

    Available in iOS 5.0 and later.

    Deprecated in iOS 6.0.

  • Sets the initial text for a tweet.

    Declaration

    Objective-C

    - (BOOL)setInitialText:(NSString *)text

    Parameters

    text

    The text to add to the tweet.

    Return Value

    YEStrue if successful. NOfalse if text does not fit in the currently available character space or the view was presented to the user.

    Import Statement

    Availability

    Available in iOS 5.0 and later.

    Deprecated in iOS 6.0.

  • addImage: addImage: (iOS 6.0)

    Adds an image to the tweet.

    Declaration

    Objective-C

    - (BOOL)addImage:(UIImage *)image

    Parameters

    image

    The image to add to the tweet.

    Return Value

    YEStrue if successful. NOfalse if image does not fit in the currently available character space or the view was presented to the user.

    Import Statement

    Availability

    Available in iOS 5.0 and later.

    Deprecated in iOS 6.0.

  • addURL: addURL: (iOS 6.0)

    Adds a URL to the tweet.

    Declaration

    Objective-C

    - (BOOL)addURL:(NSURL *)url

    Parameters

    url

    The URL to add to the tweet.

    Return Value

    YEStrue if successful. NOfalse if url does not fit in the currently available character space or the view was presented to the user.

    Import Statement

    Availability

    Available in iOS 5.0 and later.

    Deprecated in iOS 6.0.

  • Removes all images from the tweet.

    Declaration

    Objective-C

    - (BOOL)removeAllImages

    Return Value

    YEStrue if successful. NOfalse if the images were not removed because the view was presented to the user.

    Import Statement

    Availability

    Available in iOS 5.0 and later.

    Deprecated in iOS 6.0.

  • Removes all URLs from the tweet.

    Declaration

    Objective-C

    - (BOOL)removeAllURLs

    Return Value

    YEStrue if successful. NOfalse if the URLs were not removed because the view was presented to the user.

    Import Statement

    Availability

    Available in iOS 5.0 and later.

    Deprecated in iOS 6.0.

  • The handler to call when the user is done composing the tweet.

    Declaration

    Objective-C

    @property(nonatomic, copy) TWTweetComposeViewControllerCompletionHandler completionHandler

    Discussion

    The handler has a single parameter that indicates whether the user finished or cancelled composing the tweet.

    Special Considerations

    In iOS 6 and earlier, if you set a completion handler then your completion handler is responsible for dismissing the TWTweetComposeViewController using dismissViewControllerAnimated:completion:. In iOS 7 and later, you must not dismiss the TWTweetComposeViewController in your completion handler.

    Import Statement

    Availability

    Available in iOS 5.0 and later.

    Deprecated in iOS 6.0.

Data Types

  • Defines a handler to call when the user finishes composing the tweet.

    Declaration

    Swift

    typealias TWTweetComposeViewControllerCompletionHandler = SLComposeViewControllerCompletionHandler

    Objective-C

    typedef void (^TWTweetComposeViewControllerCompletionHandler)(TWTweetComposeViewControllerResult result);

    Discussion

    See TWTweetComposeViewControllerResult for possible values of the result parameter. Use the completionHandler property to set this handler.

    Import Statement

    import Twitter

    Availability

    Available in iOS 5.0 and later.

  • Possible values for the result parameter of the completionHandler property.

    Declaration

    Swift

    typealias TWTweetComposeViewControllerResult = SLComposeViewControllerResult

    Objective-C

    enum TWTweetComposeViewControllerResult { TWTweetComposeViewControllerResultCancelled, TWTweetComposeViewControllerResultDone }; typedef enum TWTweetComposeViewControllerResult TWTweetComposeViewControllerResult;

    Constants

    • TWTweetComposeViewControllerResultCancelled

      TWTweetComposeViewControllerResultCancelled

      The user cancelled composing a tweet.

      Available in iOS 5.0 and later.

    • TWTweetComposeViewControllerResultDone

      TWTweetComposeViewControllerResultDone

      The user finished composing a tweet.

      Available in iOS 5.0 and later.

    Import Statement

    import Twitter

    Availability

    Available in iOS 5.0 and later.