Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 1.33 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. twitter ios4 ..Accounts Framework
  2. if ([DETweetComposeViewController canSendTweet]) {
  3.  
  4.     DETweetComposeViewControllerCompletionHandler completionHandler = ^(DETweetComposeViewControllerResult result) {
  5.         switch (result) {
  6.             case DETweetComposeViewControllerResultCancelled:
  7.                 NSLog(@"Twitter Result: Cancelled");
  8.                 break;
  9.             case DETweetComposeViewControllerResultDone:
  10.                 NSLog(@"Twitter Result: Sent");
  11.                 break;
  12.         }
  13.         [self dismissModalViewControllerAnimated:YES];
  14.     };
  15.  
  16.     DETweetComposeViewController *tcvc = [[[DETweetComposeViewController alloc] init] autorelease];
  17.     [tcvc addImage:[UIImage imageNamed:@"YawkeyBusinessDog.jpg"]];
  18.     [tcvc addURL:[NSURL URLWithString:@"http://www.DoubleEncore.com/"]];
  19.     [tcvc addURL:[NSURL URLWithString:@"http://www.apple.com/ios/features.html#twitter"]];
  20.     self.modalPresentationStyle = UIModalPresentationCurrentContext;
  21.     [self presentModalViewController:tcvc animated:YES];
  22.  
  23. }
  24. else {
  25.     self.oAuth = [[[OAuth alloc] initWithConsumerKey:kDEConsumerKey andConsumerSecret:kDEConsumerSecret] autorelease];
  26.     TwitterDialog *td = [[[TwitterDialog alloc] init] autorelease];
  27.     td.twitterOAuth = self.oAuth;
  28.     td.delegate = self;
  29.     td.logindelegate = self;
  30.     [td show];
  31. }
  32.        
  33. #import <Accounts/Accounts.h>