2012-08-08 3 views
0

저는 iOS5에서 새로운 트위터 통합입니다.사진 iOS5의 트위터에 게시하기

서비스에서 오는 트위터에 사진을 게시해야합니다.

저는 이것에 대한 많은 예제 튜토리얼을 검색했습니다. 사진 URL 만 표시됩니다. 사진을 게시해야합니다.

아무에게도 도움이 될 수 있습니까? 미리 감사드립니다.

+0

그냥 트윗에 사진의 URL을 추가 트위터에 – Felix

+0

그래 내가 트위터 URL에 해하지 않았다는 posting.my 요구 사항입니다 그 사진을 그대로 게시하려면 ...이 일에 대해 도와주세요. – Roopa

+1

그래서 이미지를 다운로드하고'TWTweetComposeViewController' ('addImage' 메소드) – Felix

답변

0

먼저 당신이 이미지를 저장해야 다음 저장 게시 할 수 있습니다 이미지가

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