Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I program a share button ? xcode [closed]

I found a repository on gifthub that is exactly what i was looking for. Can you help me how to code this to work with a single button. I don't enough experience yet with ios programmin to do this. I almost finished building my first app, but i need help with this.

Thanks in advance

https://github.com/BobDG/BDGShare

like image 891
Deniz Yazar Avatar asked Dec 01 '22 18:12

Deniz Yazar


1 Answers

For a beginner I suggest this.. Its much easier. Just a few lines of code.

- (IBAction)shareButtonPressed:(id)sender {

    NSLog(@"shareButton pressed");
    NSString *texttoshare = @"text to share";
    UIImage *imagetoshare = [UIImage imageNamed:@"beck.png"];
    NSArray *activityItems = @[texttoshare, imagetoshare];
    UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
    activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypePostToTwitter, UIActivityTypePostToWeibo];
    [self presentViewController:activityVC animated:TRUE completion:nil];
}
like image 182
Ty Lertwichaiworawit Avatar answered Dec 11 '22 01:12

Ty Lertwichaiworawit