AirPrint and uiactionsheet - HOW?

159 Views Asked by At

I created an actionsheet that is called when a button on the navigation bar is pressed. It displays 3 buttons (send to email, print and cancel). Now I don't know how to make the iPhone print the uiwebview when the "print" button in the actionsheet is pressed. Can anyone help me ? Or maybe has some sample code for me? I am using the latest Xcode 4.3 with storyboard and programming for iphone. Thanks in advance !

1

There are 1 best solutions below

0
On

Use ActivitySheet instead...

        UIImage *yourImage = [UIImage imageNamed:@"yourImage"]; //the image you want to print
        NSArray *itemsToShare = @[yourImage];
        UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:itemsToShare applicationActivities:nil];
        activityVC.excludedActivityTypes = @[ UIActivityTypeCopyToPasteboard, UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll, UIActivityTypeMail, UIActivityTypeMessage, UIActivityTypePostToFacebook, UIActivityTypePostToTwitter, UIActivityTypePostToWeibo]; //or whichever you don't need >>> in this case we just have AirPrint
        [self presentViewController:activityVC animated:YES completion:nil];