Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (id)init {
- if (self = [super init]) {
- web = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
- url=[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
- pathForResource:@"doc1" ofType:@"html"]isDirectory:NO]];
- url1=[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
- pathForResource:@"doc2" ofType:@"html"]isDirectory:NO]];
- arr =[[NSArray alloc]initWithObjects:url,url1, nil];
- }
- return self;
- }
- - (void)dealloc {
- [images release];
- [super dealloc];
- }
- #pragma mark LeavesViewDataSource methods
- - (NSUInteger) numberOfPagesInLeavesView:(LeavesView*)leavesView {
- return arr.count;
- }
- - (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx {
- [web loadRequest:[arr objectAtIndex:index]];
- CGSize screensize = CGSizeMake(320,480);
- UIGraphicsBeginImageContext(screensize);
- CGContextRef context = UIGraphicsGetCurrentContext();
- CGFloat scalingFactor = screensize.width/web.frame.size.width;
- CGContextScaleCTM(context, scalingFactor,scalingFactor);
- [web.layer renderInContext: ctx];
- [self.view addSubview:web];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement