iOS share sheet scale modification - ios

I'm writing my app on iOS 9.3. However, my app's share sheet screen is bigger than the other app's share sheet screen. Is there any way to modify the share sheet screen to the iPhone original icons size?
Following are my code:
- (IBAction)onShareButtonClick:(UIButton *)sender {
NSString *string = #"Upload Chart";
UIImage *uploadImage = [self.selectedController performSelector:#selector(getUploadImage)];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:#[string, uploadImage] applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:nil];}
As the comment below, I found that getUploadImage is only getting the part of the screen.
if I modify the code as follow, the share sheet would be only "more more" instead. However, the size of the share icon is the same as the origin.
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityVC applicationActivities:nil];
Because the activityVC is empty.

Related

Change activity items base on which application is selected for sharing in iOS

I share an image with text to othe applications.
NSArray *activityItems = #[title, finalImage];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityVC.excludedActivityTypes = #[UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypePostToTwitter, UIActivityTypePostToWeibo];
[self presentViewController:activityVC animated:TRUE completion:nil];
Problem with this code is that I share title and image for all destination apps. but for instance, WhatsApp has problem when I share image with title. When I delete title it will correctly share the image but when I add title to activityItems, it just sends title. I want to detect if whats app is selected and then just send the image

UIActivityViewController Size

I'm trying to use UIActivityController in my app. Unfortunately the size of the modal is far too large.
On the left, the modal I want, on the right, the modal I have :
And here is the code I use to display the modal when I click on the Share button :
NSString *textToShare = #"Hello !";
NSURL *myWebsite = [NSURL URLWithString:#"http://stackoverflow.com/"];
NSArray *objectsToShare = #[textToShare, myWebsite];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
// Email subject
[activityVC setValue:#"Hello !" forKey:#"subject"];
[self presentViewController:activityVC animated:YES completion:nil];
What am I doing wrong ?
Thanks in advance.
You're doing nothing wrong, you're just using a differently sized device! Try running in the simulator using iPhone 6 or iPhone 6S and I bet you'll see exactly what you want on the left. Looks like you're just running it on a smaller device than what you want.

creating slide up menu like in iOS 7 Safari's share/bookmark menu

I'd like to create very similar sliding up menu as share/bookmark/copy/paste menu in iOS7 Safari.
What is the best way of building it?
Is there any ready made template in XCode or do I have to follow the same principle as when building the slide left/right hamburger menu?
example action:
-(IBAction)sendPost:(id)sender {
NSArray *activityItems;
activityItems = #[#"example share / copy text"]; //needs to be an array because you //could add pictures additionally
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityController
animated:YES completion:nil];
}

Recreate/Use the default iPhone Photo app save menu

I want to save a photo with the same options given by the default iPhone photo app as seen in this picture:
You can do this using UIActivityViewController. You can create a UIActivityViewController, pass it an image, or the URL to an image, and optionally tell it to exclude certain activities that you don't want to appear. Then, present it, as you would any other viewController.
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:#[ myImage ] applicationActivities:nil];
activityViewController.excludedActivityTypes = #[ UIActivityTypeAssignToContact ];
activityViewController.completionHandler = ^(NSString *activityType, BOOL completed){
// handle completion
};
[self presentViewController:activityViewController animated:YES completion:nil];
Check out the documentation for more info.

UIActivityViewController: PostToTwitter: text can´t be changed in presented modal View

i have a problem with iOS 6´s UIActivityViewController. I want to share an image and a text.
When i share it via Facebook, the text is editable in the modal view. In Twitter, i can't change the text. is there a way to change it for Twitter, so that the text is editable ?
This is my code:
NSArray *activityItems = #[#"Test Text",resultImage];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityVC.excludedActivityTypes = #[UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypeCopyToPasteboard,UIActivityTypeMessage,UIActivityTypePostToWeibo];
[self presentViewController:activityVC animated:YES completion:nil];

Resources