Getting twitter account list in IOS-5 and user it with TWTweetComposeViewController

不羁的心 提交于 2020-01-15 06:33:06

问题


i am using Twitter with IOS - 5 integration. i used tweeting app provide by apple for this.I am using TWTweetComposeViewController for this.

But if i have more than 2 twitter accounts. it is getting my first account every time. but i want that list of my different account shown to me and then when i select one of account and then i can use it with TWTweetComposeViewController. i like to show like bellow image From :"username"

i have used this code :

 - (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];

}


回答1:


Unfortunately, TWTweetComposeViewController doesn't give you much configuration flexibility. If you tap on the account name it will pop up your list of accounts. TWTweetCVC does seem to remember the last account you tweeted with though.

If you use ACAccountStore you can get the list of the users Twitter accounts and you could provide your own UI to choose one but you cannot configure TWTweetComposeViewController to use it. If you couple that with TWRequest you can roll your own tweet sheet class and do this yourself.




回答2:


DETweetComposeViewController is a drop-in replacement for TWTweetComposeViewController. It's open source, so you can modify it to meet your needs. It's also compatible with iOS 4.




回答3:


Now , i am getting my it , and picker is showing for it as shown in image

so from this picker , i can select one of my account for tweet.



来源:https://stackoverflow.com/questions/8543015/getting-twitter-account-list-in-ios-5-and-user-it-with-twtweetcomposeviewcontrol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!