My app needs to support iOS 5.
I have my custom UI where user can enter tweet message and when he presses post button, It should post message twitter.
I have already written code for posting via SLComposeViewController *tweetSheet instance
but in this case i cannot directly press send button presented by tweetSheet without presenting it by
[self presentViewController:tweetSheet animated:YES completion:nil];
Is it possible to bypass this presentation and set text message and post to twitter via my custom ui which has post button ??
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
SLComposeViewController *tweetSheet = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeTwitter];
tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) {
switch(result) {
// This means the user cancelled without sending the Tweet
case SLComposeViewControllerResultCancelled:
NSLog(@"Tweet message was cancelled");
break;
// This means the user hit 'Send'
case SLComposeViewControllerResultDone:
NSLog(@"Done pressed successfully");
break;
}
// dismiss the Tweet Sheet
dispatch_async(dispatch_get_main_queue(), ^{
[self dismissViewControllerAnimated:NO completion:^{
NSLog(@"Tweet Sheet has been dismissed.");
}];
});
};
[tweetSheet setInitialText:self.textViewPostedText.text];
[self presentViewController:tweetSheet animated:YES completion:nil];
}
How to give select option if user have multiple Twitter accounts ???
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…