一些Twitter客户端有照片推文功能。 iOS 5 Twitter API是否也包含推特照片的方式?
答案 0 :(得分:2)
阅读本文:TWTweetComposeViewController Class Reference 和 - addImage属性
答案 1 :(得分:1)
需要使用TWTweetComposeViewController类参考
答案 2 :(得分:1)
当然可以
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];
};
}