TWTweetComposeViewController Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Twitter.framework |
| Availability | Available in iOS 5.0 and later. |
| Declared in | TWTweetComposeViewController.h |
Overview
The TWTweetComposeViewController class presents a view to the user to compose a tweet.
Although you may perform Twitter requests on behalf of the user, you cannot append text, images, or URLs to tweets without the user’s knowledge. Hence, you can set the initial text and other content before presenting the tweet to the user but cannot change the tweet after the user views it. All of the methods used to set the content of the tweet return a Boolean value. The methods return NO if the content doesn’t fit in the tweet or if the view was already presented to the user and the tweet can no longer be changed.
Optionally, use the canSendTweet class method to check if Twitter is set up and reachable before presenting this view to the user.
You can also set a handler using the completionHandler property to be notified when the user is done composing the tweet. Note that completion handlers are not called on any particular thread.
Properties
completionHandler
The handler to call when the user is done composing the tweet.
Discussion
The handler has a single parameter that indicates whether the user finished or cancelled composing the tweet.
Availability
- Available in iOS 5.0 and later.
Declared In
TWTweetComposeViewController.hClass Methods
canSendTweet
Returns whether you can send a Twitter request.
Return Value
YES if Twitter is accessible and at least one account is set up; otherwise NO.
Availability
- Available in iOS 5.0 and later.
Declared In
TWTweetComposeViewController.hInstance Methods
addImage:
Adds an image to the tweet.
Parameters
- image
The image to add to the tweet.
Return Value
YES if successful. NO if image does not fit in the currently available character space or the view was presented to the user.
Availability
- Available in iOS 5.0 and later.
Declared In
TWTweetComposeViewController.haddURL:
Adds a URL to the tweet.
Parameters
- url
The URL to add to the tweet.
Return Value
YES if successful. NO if url does not fit in the currently available character space or the view was presented to the user.
Availability
- Available in iOS 5.0 and later.
Declared In
TWTweetComposeViewController.hremoveAllImages
Removes all images from the tweet.
Return Value
YES if successful. NO if the images were not removed because the view was presented to the user.
Availability
- Available in iOS 5.0 and later.
Declared In
TWTweetComposeViewController.hremoveAllURLs
Removes all URLs from the tweet.
Return Value
YES if successful. NO if the URLs were not removed because the view was presented to the user.
Availability
- Available in iOS 5.0 and later.
Declared In
TWTweetComposeViewController.hsetInitialText:
Sets the initial text for a tweet.
Parameters
- text
The text to add to the tweet.
Return Value
YES if successful. NO if text does not fit in the currently available character space or the view was presented to the user.
Availability
- Available in iOS 5.0 and later.
Declared In
TWTweetComposeViewController.hConstants
TWTweetComposeViewControllerCompletionHandler
Defines a handler to call when the user finishes composing the tweet.
typedef void (^TWTweetComposeViewControllerCompletionHandler)(TWTweetComposeViewControllerResult result);
Discussion
See “TWTweetComposeViewControllerResult” for possible values of the result parameter. Use the completionHandler property to set this handler.
Availability
- Available in iOS 5.0 and later.
Declared In
TWTweetComposeViewController.hTWTweetComposeViewControllerResult
Possible values for the result parameter of the completionHandler property.
enum TWTweetComposeViewControllerResult {
TWTweetComposeViewControllerResultCancelled,
TWTweetComposeViewControllerResultDone
};
typedef enum TWTweetComposeViewControllerResult TWTweetComposeViewControllerResult;
Constants
TWTweetComposeViewControllerResultCancelledThe user cancelled composing a tweet.
Available in iOS 5.0 and later.
Declared in
TWTweetComposeViewController.h.TWTweetComposeViewControllerResultDoneThe user finished composing a tweet.
Available in iOS 5.0 and later.
Declared in
TWTweetComposeViewController.h.
Availability
- Available in iOS 5.0 and later.
Declared In
TWTweetComposeViewController.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-02-16)