2011-12-17 23 views
2

我正在使用Twitter與IOS-5集成。我用這個蘋果提供的tweeting應用程序。我爲此使用了TWTweetComposeViewController。在IOS-5中獲取Twitter帳戶列表並用TWTweetComposeViewController將其用戶

但是,如果我有超過2個Twitter帳戶。它每次都得到我的第一個帳戶。但我希望顯示給我的不同帳戶的列表,然後當我選擇一個帳戶,然後我可以將它與TWTweetComposeViewController一起使用。我想展現像波紋圖像來源:

我已經使用這個代碼 「用戶名」:

- (IBAction)sendEasyTweet:(id)sender { 
// Set up the built-in twitter composition view controller. 
TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init]; 

// Set the initial tweet text. See the framework for additional properties that can be set. 
[tweetViewController setInitialText:@"Hello. This is a tweet."]; 
[tweetViewController addImage:[UIImage imageNamed:@"Icon.png"]]; 


// Create the completion handler block. 
[tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result) { 
    NSString *output; 

    switch (result) { 
     case TWTweetComposeViewControllerResultCancelled: 
      // The cancel button was tapped. 
      output = @"Tweet cancelled."; 
      break; 
     case TWTweetComposeViewControllerResultDone: 
      // The tweet was sent. 
      output = @"Tweet done."; 
      break; 
     default: 
      break; 
    } 

    [self performSelectorOnMainThread:@selector(displayText:) withObject:output waitUntilDone:NO]; 

    // Dismiss the tweet composition view controller. 
    [self dismissModalViewControllerAnimated:YES]; 
}]; 

// Present the tweet composition view controller modally. 
[self presentModalViewController:tweetViewController animated:YES]; 

}

enter image description here

回答

0

兼容現在,我得到我的話,並挑選器顯示如圖圖像enter image description here

所以從這個選擇器,我可以選擇我的帳戶鳴叫之一吧。

1

不幸的是,TWTweetComposeViewController不會給你太多的配置靈活性。如果您點擊賬戶名稱,它會彈出您的賬戶列表。 TWTweetCVC確實似乎記得您上次推送的帳戶。

如果您使用ACAccountStore,則可以獲取用戶Twitter帳戶的列表,並且您可以提供自己的UI以選擇其中一個,但不能配置TWTweetComposeViewController以使用它。如果你將它與TWRequest結合起來,你可以推出自己的推特表類,並自己做。

0

DETweetComposeViewController是TWTweetComposeViewController的嵌入式替代品。它是開源的,所以你可以修改它以滿足你的需求。它也與iOS 4

相關問題