Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Disable undo manager while adding annotations.

  • Loading branch information...
commit ce77da0d79652bde28c23ef70652eab2d90b052e 1 parent 898c7f3
@matthiasplappert matthiasplappert authored
Showing with 10 additions and 6 deletions.
  1. +10 −6 Examples/PSPDFCatalog/Multimedia/PSCMultimediaExample.m
View
16 Examples/PSPDFCatalog/Multimedia/PSCMultimediaExample.m
@@ -56,9 +56,11 @@ - (UIViewController *)invokeWithDelegate:(id<PSCExampleRunnerDelegate>)delegate
document.annotationSaveMode = PSPDFAnnotationSaveModeDisabled;
// dynamically add video box
- PSPDFLinkAnnotation *videoLink = [[PSPDFLinkAnnotation alloc] initWithURLString:@"pspdfkit://[autostart:false, cover:true]localhost/Bundle/big_buck_bunny.mp4"];
- videoLink.boundingBox = CGRectInset([document pageInfoForPage:0].rotatedPageRect, 100.f, 100.f);
- [document addAnnotations:@[videoLink]];
+ [document.undoController performBlockWithoutUndo:^{
+ PSPDFLinkAnnotation *videoLink = [[PSPDFLinkAnnotation alloc] initWithURLString:@"pspdfkit://[autostart:false, cover:true]localhost/Bundle/big_buck_bunny.mp4"];
+ videoLink.boundingBox = CGRectInset([document pageInfoForPage:0].rotatedPageRect, 100.f, 100.f);
+ [document addAnnotations:@[videoLink]];
+ }];
return [[PSPDFViewController alloc] initWithDocument:document];
}
@@ -86,9 +88,11 @@ - (UIViewController *)invokeWithDelegate:(id<PSCExampleRunnerDelegate>)delegate
document.annotationSaveMode = PSPDFAnnotationSaveModeDisabled;
// Dynamically add video box.
- PSPDFLinkAnnotation *video = [[PSPDFLinkAnnotation alloc] initWithURLString:@"pspdfkit://youtube.com/embed/8B-y4idg700?VQ=HD720"];
- video.boundingBox = CGRectMake(70.f, 150.f, 470.f, 270.f);
- [document addAnnotations:@[video]];
+ [document.undoController performBlockWithoutUndo:^{
+ PSPDFLinkAnnotation *video = [[PSPDFLinkAnnotation alloc] initWithURLString:@"pspdfkit://youtube.com/embed/8B-y4idg700?VQ=HD720"];
+ video.boundingBox = CGRectMake(70.f, 150.f, 470.f, 270.f);
+ [document addAnnotations:@[video]];
+ }];
return [[PSPDFViewController alloc] initWithDocument:document];
}
Please sign in to comment.
Something went wrong with that request. Please try again.