Skip to content

Instantly share code, notes, and snippets.

@jhoughjr
Created August 14, 2012 15:22
Show Gist options
  • Save jhoughjr/3350248 to your computer and use it in GitHub Desktop.
Save jhoughjr/3350248 to your computer and use it in GitHub Desktop.
wtf
- (void) aButtonTapped:(id)sender
{
if (sender == _shareWithFacebookButton)
{
DLog(@"shareWithFaceBookButton tapped");
if (_facebookController == nil) {
[self setFacebookController:[[DBFacebookController alloc] init]];
}
if ([_facebookController hasAccessToken] == NO) {
DLog(@"no access token");
[self login:self];
}else{
DLog(@"has access token");
[self post];
}
}
if (sender == _tweetButton)
{
DLog(@"tweetButton tapped");
if ([TWTweetComposeViewController canSendTweet]) {
TWTweetComposeViewController *tweetSheet =
[[TWTweetComposeViewController alloc] init];
[tweetSheet setInitialText:@"Initial Tweet Text!"];
[self presentViewController:tweetSheet
animated:YES
completion:nil];
}else {
// twitter isnt set up
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Uh-oh"
message:@"It seems your Twitter account is not set up. You can do this in the Twitter section of the Settings app."
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil, nil];
[alert show];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment