Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>i have done this by following code...</p> <pre><code>-(void)postToTwittert:(NSString *)stringtoPost { Class TWTweetComposeViewControllerClass = NSClassFromString(@"TWTweetComposeViewController"); if (TWTweetComposeViewControllerClass != nil) { if([TWTweetComposeViewControllerClass respondsToSelector:@selector(canSendTweet)]) { TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init]; [twitter setInitialText:stringtoPost]; [twitter addImage:[UIImage imageNamed:@"apple.jpg"]]; [twitter addURL:[NSURL URLWithString:@"http://www.erwinzwart.com"]]; [self findSubViewofTwitter:twitter.view]; [self presentViewController:twitter animated:YES completion:nil]; twitter.completionHandler = ^(TWTweetComposeViewControllerResult res) { if(res == TWTweetComposeViewControllerResultDone) { [self completeGameStep:@"glueper2012"]; } else if(res == TWTweetComposeViewControllerResultCancelled) { UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Canceled" message:@"Your Tweet was not posted" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } [self dismissModalViewControllerAnimated:YES]; }; } } } </code></pre> <p>by finding button and firing event </p> <pre><code> - (void) findSubViewofTwitter:(UIView*)theView { for (UIView * subview in theView.subviews) { //NSLog(@"&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; :%@", subview); if ([subview isKindOfClass:[UIButton class]]) { UIButton *btn = (UIButton *)subview; //NSLog(@"&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; is kind of class :%@", btn.titleLabel.text); if([btn.titleLabel.text isEqualToString:@"Send"]) { [btn sendActionsForControlEvents:UIControlEventTouchUpInside]; } } [self findSubViewofTwitter:subview]; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload