diff --git a/BlitzPDFView.h b/BlitzPDFView.h index 882a7db..a65fcde 100644 --- a/BlitzPDFView.h +++ b/BlitzPDFView.h @@ -11,6 +11,7 @@ @property uint16_t secondsElapsed; +- (void)atLastPage; - (IBAction)updateSecondsElapsed:(id)sender; @end diff --git a/BlitzPDFView.m b/BlitzPDFView.m index bd9349c..fe0cc40 100644 --- a/BlitzPDFView.m +++ b/BlitzPDFView.m @@ -163,9 +163,8 @@ - (void)drawPagePost:(PDFPage*)page { [counterView setNeedsDisplay: YES]; } -- (void)dealloc -{ - [counterView release]; +- (void)dealloc { + [self atLastPage]; [super dealloc]; } @@ -175,7 +174,12 @@ - (uint16_t) secondsElapsed { - (void)setSecondsElapsed:(uint16_t)secs { secondsElapsed = secs; - counterView.secondsElapsed = secs; + counterView.secondsElapsed = secs; +} + +- (void)atLastPage { + [[counterView animator] removeFromSuperview]; + counterView = nil; } - (IBAction)updateSecondsElapsed:(id)sender { diff --git a/MyDocument.m b/MyDocument.m index 98f1e7f..c2c284e 100644 --- a/MyDocument.m +++ b/MyDocument.m @@ -52,7 +52,13 @@ - (BOOL)readFromURL:(NSURL *)initWithURL ofType:(NSString *)typeName error:(NSEr - (void)updateElapsedTimer:(NSTimer*)timer_ { if (self.pdfView.secondsElapsed != 0 && (self.pdfView.secondsElapsed % 15 == 0)) { - [self.pdfView goToNextPage:nil]; + if ([self.pdfView canGoToNextPage]) { + [self.pdfView goToNextPage:nil]; + } + else { + [self.pdfView atLastPage]; + [timer_ invalidate]; + } } self.pdfView.secondsElapsed += 1; [self.pdfView setNeedsDisplay:YES];