照片发布在iOS5的推特
问题描述:
我是新的一个在twitter5整合在iOS5。照片发布在iOS5的推特
我需要在twitter上发布照片来自服务。
我已经搜索了许多,并在此练习了示例教程。 我只收到照片网址。我需要张贴照片。
有谁能帮我解决这个问题吗? 在此先感谢。
答
首先,你需要保存的图片,然后你可以发布保存的图像叽叽喳喳
self.shareImg.image = [UIImage imageNamed:@"Your Saved image"];
if ([[[UIDevice currentDevice] systemVersion] floatValue] > 5.0) {
// Create the view controller
TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];
NSString *str = [NSString stringWithFormat:@"I created this photo http://%@", iTune];
// Optional: set an image, url and initial text
[twitter addImage:self.shareImg.image];
[twitter setInitialText:[NSString stringWithFormat:@"I created this photo using USC Project Trojan App:http://uslofphoto.com. Download http://%@", iTune]];
// 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];
};
}
+0
感谢您的回复 – Roopa 2012-08-13 10:35:21
只是照片的URL附加到鸣叫 – Felix 2012-08-08 10:03:17
是的,我做了它。但是在Twitter的网址是posting.my要求张贴照片,因为它是...帮助我这一点。 – Roopa 2012-08-08 13:24:53
所以你需要下载图片,然后使用'TWTweetComposeViewController'('addImage'方法) – Felix 2012-08-08 16:34:51