Iphone 在IOS-5中获取twitter帐户列表并使用TWTweetComposeViewController使用它
我正在使用集成了IOS-5的Twitter。为此,我使用了苹果公司提供的推文应用程序。我正在使用tweetcomposeviewcontroller 但如果我有两个以上的twitter账户。每次都是我的第一个账户。但我希望我的不同帐户列表显示给我,然后当我选择一个帐户,然后我可以使用它与tweetcomposeviewcontroller。我喜欢显示下面的图片:“用户名” 我使用了以下代码:Iphone 在IOS-5中获取twitter帐户列表并使用TWTweetComposeViewController使用它,iphone,objective-c,ios,ios5,twitter,Iphone,Objective C,Ios,Ios5,Twitter,我正在使用集成了IOS-5的Twitter。为此,我使用了苹果公司提供的推文应用程序。我正在使用tweetcomposeviewcontroller 但如果我有两个以上的twitter账户。每次都是我的第一个账户。但我希望我的不同帐户列表显示给我,然后当我选择一个帐户,然后我可以使用它与tweetcomposeviewcontroller。我喜欢显示下面的图片:“用户名” 我使用了以下代码: - (IBAction)sendEasyTweet:(id)sender { // Set up th
- (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];
}
不幸的是,
tweetcomposeviewcontroller
并没有给您太多的配置灵活性。如果您点击帐户名,它将弹出您的帐户列表TWTweetCVC
似乎还记得你上一次在推特上使用的帐户
如果您使用
ACAccountStore
,您可以获得用户Twitter帐户的列表,您可以提供自己的UI来选择一个帐户,但您无法配置tweetcomposeviewcontroller
来使用它。如果你将它与tweetRequest结合使用,你就可以推出自己的tweet sheet类并自己做。是tweetComposeViewController的替代品。它是开源的,因此您可以修改它以满足您的需要。它还与iOS 4兼容。现在,我正在获取我的It,picker正在为它显示,如图所示
因此,从这个选择器中,我可以为tweet选择我的一个帐户