.h
#import <UIKit/UIKit.h>
@interface PdfView : UIView
{
CGPDFDocumentRef pdf;
// int totalPages;
// int currentPage;
}
@property(nonatomic)int totalPages;
@property(nonatomic)int currentPage;
-(void)drawInContext:(CGContextRef)context;
-(void)goUpPage;
-(void)goDownPage;
@end
.m
#import "PdfView.h"
@implementation PdfView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
-(void)reloadView{
[self setNeedsDisplay];
}
-(void)goUpPage{
if(_currentPage < 2)
return;
--_currentPage;
[self reloadView];
}
-(void)goDownPage{
if(_currentPage >=_totalPages)
return;