Permalink
Browse files

Version 2.6.1

  • Loading branch information...
1 parent 6a4d7a0 commit 2c755958bad5879e1bf3c9bdd145306011817280 @vfr committed Oct 5, 2012
View
@@ -1,6 +1,11 @@
## History
+2012-10-05: Version 2.6.1
+
+ - Greatly improved thumb operation cancel handling.
+ - iOS 4 support and various other miscellaneous fixes.
+
2012-09-24: Version 2.6.0
- Refactored to use ARC memory management.
View
@@ -16,10 +16,10 @@ project template that you could start building from, or, just pull
the required files into an existing project to enable PDF
reading/viewing in your app(s).
-![iPod Page](http://i.imgur.com/DYElY.png)
-![iPod Thumbs](http://i.imgur.com/61YJY.png)
-![iPad Page](http://i.imgur.com/mY0gp.png)
-![iPad Thumbs](http://i.imgur.com/3HCkj.png)
+![iPod Page](http://i.imgur.com/wxC1B.png)
+![iPod Thumbs](http://i.imgur.com/4VNyQ.png)
+![iPad Page](http://i.imgur.com/T6nfI.png)
+![iPad Thumbs](http://i.imgur.com/wxQRC.png)
After launching the sample app, tap on the left hand side of the
screen to go back a page. Tap on the right hand side to go to the
View
@@ -26,9 +26,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>2.6.0</string>
+ <string>2.6.1</string>
<key>CFBundleShortVersionString</key>
- <string>2.6.0</string>
+ <string>2.6.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIPrerenderedIcon</key>
@@ -295,10 +295,10 @@
45AB72EE141FC0B1003524C3 /* CGPDFDocument.m */,
45D5ADA11610EADC00706B9A /* ReaderDocumentOutline.h */,
45D5ADA21610EADC00706B9A /* ReaderDocumentOutline.m */,
- 45AB72FF141FC0B1003524C3 /* ReaderThumbCache.h */,
- 45AB7300141FC0B1003524C3 /* ReaderThumbCache.m */,
45AB7307141FC0B1003524C3 /* ReaderThumbRequest.h */,
45AB7308141FC0B1003524C3 /* ReaderThumbRequest.m */,
+ 45AB72FF141FC0B1003524C3 /* ReaderThumbCache.h */,
+ 45AB7300141FC0B1003524C3 /* ReaderThumbCache.m */,
45AB7303141FC0B1003524C3 /* ReaderThumbQueue.h */,
45AB7304141FC0B1003524C3 /* ReaderThumbQueue.m */,
45AB7301141FC0B1003524C3 /* ReaderThumbFetch.h */,
@@ -1,6 +1,6 @@
//
// ReaderContentPage.h
-// Reader v2.6.0
+// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -45,7 +45,7 @@
@property (nonatomic, assign, readonly) CGPDFDictionaryRef dictionary;
-+ (id)withRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary;
++ (id)newWithRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary;
- (id)initWithRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary;
@@ -1,6 +1,6 @@
//
// ReaderContentPage.m
-// Reader v2.6.0
+// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -131,7 +131,7 @@ - (ReaderDocumentLink *)linkFromAnnotation:(CGPDFDictionaryRef)annotationDiction
CGRect viewRect = CGRectMake(vr_x, vr_y, vr_w, vr_h); // View CGRect from PDFRect
- documentLink = [ReaderDocumentLink withRect:viewRect dictionary:annotationDictionary];
+ documentLink = [ReaderDocumentLink newWithRect:viewRect dictionary:annotationDictionary];
}
return documentLink;
@@ -531,9 +531,11 @@ - (void)didMoveToWindow
- (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
{
- CGPDFPageRef drawPDFPageRef = NULL;
+ ReaderContentPage *readerContentPage = self; // Retain self
- CGPDFDocumentRef drawPDFDocRef = NULL;
+ CGPDFPageRef drawPDFPageRef = NULL; // Document page reference
+
+ CGPDFDocumentRef drawPDFDocRef = NULL; // Document reference
@synchronized(self) // Block any other threads
{
@@ -542,12 +544,12 @@ - (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
drawPDFPageRef = CGPDFPageRetain(_PDFPageRef);
}
- //NSLog(@"%s %@", __FUNCTION__, NSStringFromCGRect(CGContextGetClipBoundingBox(context)));
-
CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // White
CGContextFillRect(context, CGContextGetClipBoundingBox(context)); // Fill
+ //NSLog(@"%s %@", __FUNCTION__, NSStringFromCGRect(CGContextGetClipBoundingBox(context)));
+
if (drawPDFPageRef != NULL) // Go ahead and render the PDF page into the context
{
CGContextTranslateCTM(context, 0.0f, self.bounds.size.height); CGContextScaleCTM(context, 1.0f, -1.0f);
@@ -560,6 +562,8 @@ - (void)drawLayer:(CATiledLayer *)layer inContext:(CGContextRef)context
}
CGPDFPageRelease(drawPDFPageRef); CGPDFDocumentRelease(drawPDFDocRef); // Cleanup
+
+ if (readerContentPage != nil) readerContentPage = nil; // Release self
}
@end
@@ -584,7 +588,7 @@ @implementation ReaderDocumentLink
#pragma mark ReaderDocumentLink class methods
-+ (id)withRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary
++ (id)newWithRect:(CGRect)linkRect dictionary:(CGPDFDictionaryRef)linkDictionary
{
return [[ReaderDocumentLink alloc] initWithRect:linkRect dictionary:linkDictionary];
}
@@ -1,6 +1,6 @@
//
// ReaderContentView.m
-// Reader v2.6.0
+// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-07-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -153,7 +153,9 @@ - (id)initWithFrame:(CGRect)frame fileURL:(NSURL *)fileURL page:(NSUInteger)page
- (void)dealloc
{
- [self removeObserver:self forKeyPath:@"frame"];
+// [self removeObserver:self forKeyPath:@"frame" context:ReaderContentViewContext];
+
+ [self removeObserver:self forKeyPath:@"frame"]; // Maintain iOS 4.x compatability
}
- (void)showPageThumb:(NSURL *)fileURL page:(NSInteger)page password:(NSString *)phrase guid:(NSString *)guid
@@ -164,7 +166,7 @@ - (void)showPageThumb:(NSURL *)fileURL page:(NSInteger)page password:(NSString *
CGSize size = (large ? CGSizeMake(PAGE_THUMB_LARGE, PAGE_THUMB_LARGE) : CGSizeMake(PAGE_THUMB_SMALL, PAGE_THUMB_SMALL));
- ReaderThumbRequest *request = [ReaderThumbRequest forView:theThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];
+ ReaderThumbRequest *request = [ReaderThumbRequest newForView:theThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];
UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:request priority:YES]; // Request the page thumb
@@ -1,6 +1,6 @@
//
// ReaderDocumentOutline.m
-// Reader v2.6.0
+// Reader v2.6.1
//
// Created by Julius Oklamcak on 2012-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -35,7 +35,7 @@
@interface DocumentOutlineEntry : NSObject <NSObject>
-+ (id)withTitle:(NSString *)title target:(id)target level:(NSInteger)level;
++ (id)newWithTitle:(NSString *)title target:(id)target level:(NSInteger)level;
- (id)initWithTitle:(NSString *)title target:(id)target level:(NSInteger)level;
@@ -1,6 +1,6 @@
//
// ReaderDocumentOutline.m
-// Reader v2.6.0
+// Reader v2.6.1
//
// Created by Julius Oklamcak on 2012-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -343,7 +343,7 @@ + (void)outlineItems:(CGPDFDictionaryRef)outlineDictionary document:(CGPDFDocume
NSString *trimmed = [titleString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
- outlineEntry = [DocumentOutlineEntry withTitle:trimmed target:entryTarget level:level]; // New entry
+ outlineEntry = [DocumentOutlineEntry newWithTitle:trimmed target:entryTarget level:level]; // New entry
[array addObject:outlineEntry]; CFRelease(title); // Add new entry and cleanup
}
@@ -440,7 +440,7 @@ @implementation DocumentOutlineEntry
#pragma mark DocumentOutlineEntry class methods
-+ (id)withTitle:(NSString *)title target:(id)target level:(NSInteger)level
++ (id)newWithTitle:(NSString *)title target:(id)target level:(NSInteger)level
{
return [[DocumentOutlineEntry alloc] initWithTitle:title target:target level:level];
}
@@ -1,6 +1,6 @@
//
// ReaderMainPagebar.m
-// Reader v2.6.0
+// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -110,7 +110,7 @@ - (void)updatePageThumbView:(NSInteger)page
NSURL *fileURL = document.fileURL; NSString *guid = document.guid; NSString *phrase = document.password;
- ReaderThumbRequest *request = [ReaderThumbRequest forView:pageThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];
+ ReaderThumbRequest *request = [ReaderThumbRequest newForView:pageThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];
UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:request priority:YES]; // Request the thumb
@@ -285,7 +285,7 @@ - (void)layoutSubviews
smallThumbView = [[ReaderPagebarThumb alloc] initWithFrame:thumbRect small:YES]; // Create a small thumb view
- ReaderThumbRequest *thumbRequest = [ReaderThumbRequest forView:smallThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];
+ ReaderThumbRequest *thumbRequest = [ReaderThumbRequest newForView:smallThumbView fileURL:fileURL password:phrase guid:guid page:page size:size];
UIImage *image = [[ReaderThumbCache sharedInstance] thumbRequest:thumbRequest priority:NO]; // Request the thumb
@@ -1,6 +1,6 @@
//
// ReaderThumbFetch.h
-// Reader v2.6.0
+// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -31,6 +31,6 @@
@interface ReaderThumbFetch : ReaderThumbOperation
-- (id)initWithRequest:(ReaderThumbRequest *)object;
+- (id)initWithRequest:(ReaderThumbRequest *)options;
@end
View
@@ -1,6 +1,6 @@
//
// ReaderThumbFetch.m
-// Reader v2.6.0
+// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -37,29 +37,25 @@ @implementation ReaderThumbFetch
#pragma mark ReaderThumbFetch instance methods
-- (id)initWithRequest:(ReaderThumbRequest *)object
+- (id)initWithRequest:(ReaderThumbRequest *)options
{
- if ((self = [super initWithGUID:object.guid]))
+ if ((self = [super initWithGUID:options.guid]))
{
- request = object;
+ request = options;
}
return self;
}
-- (void)dealloc
-{
- if (request.thumbView.operation == self)
- {
- request.thumbView.operation = nil; // Done
- }
-}
-
- (void)cancel
{
- [[ReaderThumbCache sharedInstance] removeNullForKey:request.cacheKey];
+ [super cancel]; // Cancel the operation
- [super cancel];
+ request.thumbView.operation = nil; // Break retain loop
+
+ request.thumbView = nil; // Release target thumb view on cancel
+
+ [[ReaderThumbCache sharedInstance] removeNullForKey:request.cacheKey];
}
- (NSURL *)thumbFileURL
@@ -73,9 +69,7 @@ - (NSURL *)thumbFileURL
- (void)main
{
- if (self.isCancelled == YES) return;
-
- NSURL *thumbURL = [self thumbFileURL]; CGImageRef imageRef = NULL;
+ CGImageRef imageRef = NULL; NSURL *thumbURL = [self thumbFileURL];
CGImageSourceRef loadRef = CGImageSourceCreateWithURL((__bridge CFURLRef)thumbURL, NULL);
@@ -95,11 +89,11 @@ - (void)main
{
request.thumbView.operation = thumbRender; // Update the thumb view operation property to the new operation
- [[ReaderThumbQueue sharedInstance] addWorkOperation:thumbRender]; // Queue the operation
+ [[ReaderThumbQueue sharedInstance] addWorkOperation:thumbRender]; return; // Queue the operation
}
}
- if (imageRef != NULL) // Create UIImage from CGImage and show it
+ if (imageRef != NULL) // Create a UIImage from a CGImage and show it
{
UIImage *image = [UIImage imageWithCGImage:imageRef scale:request.scale orientation:UIImageOrientationUp];
@@ -113,7 +107,7 @@ - (void)main
UIGraphicsEndImageContext(); // Cleanup after the bitmap-based graphics drawing context
- [[ReaderThumbCache sharedInstance] setObject:decoded forKey:request.cacheKey]; // Update cache
+ [[ReaderThumbCache sharedInstance] setObject:decoded forKey:request.cacheKey]; // Cache it
if (self.isCancelled == NO) // Show the image in the target thumb view on the main thread
{
@@ -127,6 +121,8 @@ - (void)main
});
}
}
+
+ request.thumbView.operation = nil; // Break retain loop
}
@end
@@ -1,6 +1,6 @@
//
// ReaderThumbRender.h
-// Reader v2.6.0
+// Reader v2.6.1
//
// Created by Julius Oklamcak on 2011-09-01.
// Copyright © 2011-2012 Julius Oklamcak. All rights reserved.
@@ -31,6 +31,6 @@
@interface ReaderThumbRender : ReaderThumbOperation
-- (id)initWithRequest:(ReaderThumbRequest *)request;
+- (id)initWithRequest:(ReaderThumbRequest *)options;
@end
Oops, something went wrong.

0 comments on commit 2c75595

Please sign in to comment.