How i zoom perticular part of UIScrollView?

Posted by Rajendra Bhole on Stack Overflow See other posts from Stack Overflow or by Rajendra Bhole
Published on 2010-05-21T06:35:01Z Indexed on 2010/05/21 10:20 UTC
Read the original article Hit count: 488

Filed under:

HI, I develop an application in which i want to implement the splash screen, on that splash screen i want to bind the scrollView and UIImage. My code as follow,

-(void)splashAnimation{
    window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, 320, 420)];
    //scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
    scrollView = [[UIScrollView alloc] initWithFrame:[window bounds]];
    scrollView.pagingEnabled = NO;
    scrollView.bounces = NO;

    UIImage *image = [UIImage imageNamed:@"splash.png"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    imageView.userInteractionEnabled = NO;  

    [scrollView addSubview:imageView];
    [scrollView setDelegate:self];
    //[scrollView release];


}

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
    [self splashAnimation];
    [self initControllers];
    [window addSubview:[mainTabBarController view]];
    [window makeKeyAndVisible];
}

On my given code the one blank window comes up and stay on. I want to on that blank screen bind my splash.png.

*The Above problem is solved* My current code is

scrollView.pagingEnabled = NO; scrollView.bounces = NO;

UIImage *image = [UIImage imageNamed:@"splash.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
imageView.userInteractionEnabled = NO;  
[scrollView addSubview:imageView];

scrollView.maximumZoomScale = 4.0f;
scrollView.minimumZoomScale = 1.0f;

CGRect rect = CGRectMake(119, 42, 208, 166);

[scrollView zoomToRect:rect animated:YES];
[scrollView setDelegate:self];
[window addSubview:scrollView];
[window makeKeyAndVisible];

i want to zoom the particular part of scrollView.

© Stack Overflow or respective owner

Related posts about iphone