File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 1111
1212@property uint16_t secondsElapsed;
1313
14+ - (void )atLastPage ;
1415- (IBAction )updateSecondsElapsed : (id )sender ;
1516
1617@end
Original file line number Diff line number Diff line change @@ -163,9 +163,8 @@ - (void)drawPagePost:(PDFPage*)page {
163163 [counterView setNeedsDisplay: YES ];
164164}
165165
166- - (void )dealloc
167- {
168- [counterView release ];
166+ - (void )dealloc {
167+ [self atLastPage ];
169168 [super dealloc ];
170169}
171170
@@ -175,7 +174,12 @@ - (uint16_t) secondsElapsed {
175174
176175- (void )setSecondsElapsed : (uint16_t )secs {
177176 secondsElapsed = secs;
178- counterView.secondsElapsed = secs;
177+ counterView.secondsElapsed = secs;
178+ }
179+
180+ - (void )atLastPage {
181+ [[counterView animator ] removeFromSuperview ];
182+ counterView = nil ;
179183}
180184
181185- (IBAction )updateSecondsElapsed : (id )sender {
Original file line number Diff line number Diff line change @@ -52,7 +52,13 @@ - (BOOL)readFromURL:(NSURL *)initWithURL ofType:(NSString *)typeName error:(NSEr
5252
5353- (void )updateElapsedTimer : (NSTimer *)timer_ {
5454 if (self.pdfView .secondsElapsed != 0 && (self.pdfView .secondsElapsed % 15 == 0 )) {
55- [self .pdfView goToNextPage: nil ];
55+ if ([self .pdfView canGoToNextPage ]) {
56+ [self .pdfView goToNextPage: nil ];
57+ }
58+ else {
59+ [self .pdfView atLastPage ];
60+ [timer_ invalidate ];
61+ }
5662 }
5763 self.pdfView .secondsElapsed += 1 ;
5864 [self .pdfView setNeedsDisplay: YES ];
You can’t perform that action at this time.
0 commit comments