Its my first time posting so please bear with me. I have been searching sites after sites and I can't seem to find any which has resolved this issue. Would be happy if someone could answer me.
LeavesCache.m was modified last year if not mistaken to accommodate ios 7 i think.
The code is below however I receive a EXC_BAD_ACCESS
for return pageImage.CGImage
.
I changed it to return (__bridge CGImageRef)(pageImage)
but now my page comes out blank even though it prints the correct page index. Please help!
CGImageRef)cachedImageForPageIndex:(NSUInteger)pageIndex {
NSNumber *pageIndexNumber = [NSNumber numberWithInt:pageIndex];
UIImage *pageImage;
@synchronized (self.pageCache) {
pageImage = [self.pageCache objectForKey:pageIndexNumber];
}
if (!pageImage) {
CGImageRef pageCGImage = CGImageRetain([self imageForPageIndex:pageIndex]);
if (pageCGImage) {
pageImage = [UIImage imageWithCGImage:pageCGImage];
@synchronized (self.pageCache) {
[self.pageCache setObject:pageImage forKey:pageIndexNumber];
}
}
}
//modified here
//return pageImage.CGImage;
return (__bridge CGImageRef)(pageImage);
}
On a quick note, the content comes out perfectly on the simulator but blank on the iPad.
I managed to finally resolve this. How proper is this I don't know. But to those using LeavesView. If 'return pageImage.CGImage' is throwing you 'EXC_BAD_ACCESS', you can resolve it by removing this line:
It is found in this function, 'imageForPageIndex':
Please maintain your 'cachedImageForPageIndex:' function. If you have changed it, the code is as follows: