little more help with a CATiledLayer

Posted by Brodie4598 on Stack Overflow See other posts from Stack Overflow or by Brodie4598
Published on 2010-04-29T15:03:54Z Indexed on 2010/04/29 15:07 UTC
Read the original article Hit count: 807

Filed under:
|
|
|

Okay so I am trying to adapt an online tutorial for CATiledLayer to use in my app. The example uses a PDF but I need to display a JPG.

I'm getting close, but I just cant figure this out. Should I be using a UIImage or something else?

#import <QuartzCore/QuartzCore.h>
#import "practiceViewController.h"

@implementation practiceViewController


- (void)viewDidLoad
{
    [super viewDidLoad];

    NSBundle *bundle = [[NSBundle mainBundle]autorelease];
    NSString *path = [bundle pathForResource:@"H-5" ofType:@"jpg"];
    NSData *data = [NSData dataWithContentsOfFile:path];
    image = [UIImage imageWithData:data];

    CGRect pageRect = CGRectMake(0,  0,  1600, 2400);

    CATiledLayer *tiledLayer = [CATiledLayer layer];
    tiledLayer.delegate = self;
    tiledLayer.tileSize = CGSizeMake(1024.0, 1024.0);
    tiledLayer.levelsOfDetail = 1000;
    tiledLayer.levelsOfDetailBias = 1000;
    tiledLayer.frame = pageRect; 

    myContentView = [[UIView alloc] initWithFrame:pageRect];
    [myContentView.layer addSublayer:tiledLayer];

    CGRect viewFrame = self.view.frame;
    viewFrame.origin = CGPointZero;
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:viewFrame];
    scrollView.delegate = self;
    scrollView.contentSize = pageRect.size;
    scrollView.maximumZoomScale = 1000;
    [scrollView addSubview:myContentView];

    [self.view addSubview:scrollView];
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
    return myContentView;
}

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{

NEED HE:LP WITH THIS

}

@end

© Stack Overflow or respective owner

Related posts about iphone

Related posts about ipad