Hallo Community
Ich versuche gerade Airprint in meine App einzubringen. Dazu habe ich einen Button in einem ActionSheet. Wenn ich diesen Code hier nehme:
Code DetailNews.m:
Alles anzeigen
Bekomme ich einen Use ofundeclared identifier of "printItem" Der Code im entsprechenden Headerfile sieht so aus:
Code DetailNews.h:
Alles anzeigen
Was mache ich hier falsch?
Ich versuche gerade Airprint in meine App einzubringen. Dazu habe ich einen Button in einem ActionSheet. Wenn ich diesen Code hier nehme:
Code DetailNews.m:
Quellcode
- if (saveEnabled && buttonIdx == 3) {
- -(void)printItem :(NSData*)data {
- printController = [UIPrintInteractionController sharedPrintController];
- if(printController && [UIPrintInteractionController canPrintData:data]) {
- printController.delegate = self;
- UIPrintInfo *printInfo = [UIPrintInfo printInfo];
- printInfo.outputType = UIPrintInfoOutputGeneral;
- printInfo.jobName = [NSString stringWithFormat:@""];
- printInfo.duplex = UIPrintInfoDuplexLongEdge;
- printController.printInfo = printInfo;
- printController.showsPageRange = YES;
- printController.printingItem = data;
- void (^completionHandler)(UIPrintInteractionController *, BOOL, NSError *) = ^(UIPrintInteractionController *printController, BOOL completed, NSError *error) {
- if (!completed && error) {
- NSLog(@"FAILED! due to error in domain %@ with error code %u", error.domain, error.code);
- }
- };
- [printController presentFromBarButtonItem:self.item animated:YES completionHandler:completionHandler];
- }
- }
Bekomme ich einen Use ofundeclared identifier of "printItem" Der Code im entsprechenden Headerfile sieht so aus:
Code DetailNews.h:
Quellcode
- SLComposeViewController *mySLComposerSheet;
- @interface DetailNews : DetailViewController <UIActionSheetDelegate, MFMailComposeViewControllerDelegate, UIAlertViewDelegate> {
- BOOL showSave;
- UIActionSheet *loadingActionSheet;
- UIPageControl *pageControl;
- NSInteger currentPage;
- }
- @property (readwrite) BOOL showSave;
- @property (nonatomic, strong) IBOutlet UIPageControl *pageControl;
- @property (nonatomic, assign) NSInteger currentPage;
- - (IBAction)changePage:(UIPageControl *)sender;
- // add the appropriate delegate
- @end
- @interface ViewController : UIViewController <UIPrintInteractionControllerDelegate> {
- // have an instance varialbe for accessing printInteraction
- UIPrintInteractionController *printController;
- }
- // an imageView from which we will obtain data of an image
- @property (nonatomic, strong) IBOutlet UIImageView *imgV;
- // a general method which will print the data supplied
- -(void)printItem :(NSData*)data;
Was mache ich hier falsch?
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von Thaddel ()