FastPdfKit - 执行didReceiveDoubleTapOnAnnotationRect后UI丢失

时间:2012-03-16 01:38:00

标签: ios pdf delegates

使用FastPdfKit(FastPdfKit sdk site),我使用以下代码实现了documentViewController:didReceiveDoubleTapOnAnnotationRect

-(void)documentViewController:(MFDocumentViewController *)dvc didReceiveTapOnAnnotationRect:(CGRect)rect withUri:(NSString *)uri onPage:(NSUInteger)page {    
  NSArray *arrayParameter = nil;
  NSString *uriType = nil;
  NSString *uriResource = nil;

  arrayParameter = [uri componentsSeparatedByString:@"://"];

  uriType = [NSString stringWithFormat:@"%@", [arrayParameter objectAtIndex:0]];

  uriResource = [NSString stringWithFormat:@"%@", [arrayParameter objectAtIndex:1]];

  if ([uriType isEqualToString:@"pamv1"]) {
    NSString *marker = uriResource;
    NSLog(@"Marker: %@", marker);
  }
}

这是有效的。当我双击注释时,NSLog的输出显示:

2012-03-15 17:37:53:599 iFlightBag[8286:1799] -[ManualsListViewController documentViewController:didReceiveDoubleTapOnAnnotationRect:withUri:onPage:] [Line 155] Marker: Builtin_Manual_IOM_annotations.pdf?page=3&paragraph=6&edit=0

问题:当我设置代理时,我丢失了内置的阅读器UI:点击菜单,完成按钮,缩略图等...我仍然有滑动和点击边缘来更改页面,双-tap(在非注释部分)和捏缩放。所以我无法退出查看器(以及控件UI中的所有其他功能)。我使用以下方式设置代理:

[pdfViewController setDocumentDelegate:self];

在我的应用程序中实现FastPdfKit的整个代码(主要来自他们的示例):

-(void)openFastPdfURL:(NSURL *)documentUrl {

  // TestFlight api
  TESTFLIGHT_CHECKPOINT(@"ManualsFastPdfKit");

  /** Set document name */
  NSString *documentName = [documentUrl lastPathComponent];

  /** Get temporary directory to save thumbnails */
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);

  /** Set thumbnails path */
  NSString *thumbnailsPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",documentName]];

  /** Get document from the App Bundle */
  // NSURL *documentUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:documentName ofType:@"pdf"]];

  /** Instancing the documentManager */
  MFDocumentManager *documentManager = [[MFDocumentManager alloc]initWithFileUrl:documentUrl];

  /** Instancing the readerViewController */
  ReaderViewController *pdfViewController = [[ReaderViewController alloc]initWithDocumentManager:documentManager];

  /** Set resources folder on the manager */
  documentManager.resourceFolder = thumbnailsPath;

  /** Set document id for thumbnail generation */
  pdfViewController.documentId = documentName;

  /** Set the delegate */
  [pdfViewController setDocumentDelegate:self];

  /** Present the pdf on screen in a modal view */
  [self presentModalViewController:pdfViewController animated:YES]; 

  /** Release the pdf controller*/
  [pdfViewController release];
}

和我的didSelectRowAtIndexPath:

// fastPdfKit
else if ([manuals.Format isEqualToString:@"fastpdf"]) {
    [self openFastPdfURL:[self locateUrl:[NSURL URLWithString:manuals.Url] ofType:[manuals.Url pathExtension]]];
}

我的目标: 1.有一个快速的内部PDF阅读器(完整) 2.处理自定义注释(正在进行中)

我还需要保持读者用户界面,以便用户处理书签,搜索,缩略图,结束查看器等...

如果我注释掉

[pdfViewController setDocumentDelegate:self];

行,完整的UI回来了。有没有人实现过FastPdfKit的注释界面?

0 个答案:

没有答案