-(void)ShareImageandText:(UIButton *)sender
{
NSString *texttoshare =@" http://qrs.ly/l851gh4 ";
UIImage *image = [UIImage imageNamed:@"default"];
NSString *noteStr = [NSString stringWithFormat:@"Please follow this link below to install the Freedom.desi application on your IPhone. %@",texttoshare];
NSURL *url = [NSURL URLWithString:texttoshare];
NSArray *activityItems = @[noteStr,image];
NSLog(@"this %@",activityItems);
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[noteStr,image] applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypePrint];
[self shareText:noteStr
andImage:image andUrl:nil];
[self presentViewController:activityVC animated:TRUE completion:nil];
}
//if iPad
else {
// Change Rect to position Popover
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[noteStr, url] applicationActivities:nil];
activityVC.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypePrint];
[self shareText:noteStr
andImage:image andUrl:nil];
UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityVC];
[popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}