views:

34

answers:

0

I'm modifying the QuartzDemo sample app from Apple.

In QuartzViewController.m I have modifications (by DyingCactus) which replac the back button and add a method to handle the back button press as follows:

-(void)viewDidLoad
{
    // Add the QuartzView
    [scrollView addSubview:self.quartzView];

    //add custom back button if this is the PDF view...
    if ([self.quartzView isKindOfClass:[QuartzPDFView class]])
    {
        self.navigationItem.leftBarButtonItem =
        [[UIBarButtonItem alloc] initWithTitle:@"QuartzDemo"
                                 style:UIBarButtonItemStyleBordered
                                 target:self
                                 action:@selector(myBackButtonHandler:)];
    }
}

- (void)myBackButtonHandler:(id)sender
{
    [self.quartzView setFrame:CGRectMake(150, -200, 100, 200)];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
    [UIView setAnimationDuration:1.0];
    [self.quartzView setFrame:CGRectMake(150, 0, 100, 200)];
    [UIView commitAnimations]; 
}

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{
    [self.navigationController popViewControllerAnimated:YES];
}

I have a PNG image in resources folder called "bookmark.png" and would like to have that image animate as in animation in the example above. The image can be loaded in an UImageview or something and lets say that I have one called bookmark.

How do I call that instead of self.quartzview in this part of code:

[self.quartzView setFrame:CGRectMake(150, -200, 100, 200)];
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
    [UIView setAnimationDuration:1.0];
    [self.quartzView setFrame:CGRectMake(150, 0, 100, 200)];
    [UIView commitAnimations];