I have a pdf page displayed with CGContextDrawPDFPage in QuartzDemo sample application.
I want to keep this page shown and have an image slide in from top over this page, just as it can be seen in the iBooks application.
It’s a book, the sliding image is a bookmark that slides in when you are about to close the book.
I added this code by DyingCactus (hint: im a newbie to obj c and iphone dev) as follows:
In QuartzViewController.m, the animation starts to show but the view slides away before the animation is finished, in fact I think the animation goes on while the view is sliding away.
-(void)viewWillDisappear:(BOOL)animated
{
[self.quartzView setFrame:CGRectMake(150, -200, 100, 200)];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[self.quartzView setFrame:CGRectMake(150, 0, 100, 200)];
[UIView commitAnimations];
}
How can I keep the view visible and finish the animation before view disappears?
I assume you’re modifying the QuartzDemo sample app from Apple.
Best way I can think of right now is to replace the back button on the navigation controller with your own button when the view being shown is the PDF view.
Your custom back button can then manage the animation and view popping sequence as needed.
Only annoyance with this is that the back button no longer has a left-arrow shape.
Here are the changes needed in QuartzViewController.m: