iphone - wrong animations - iphone

I am building a book where I will use the page curl animation to flip the pages, something like this:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.45f];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:NO];
[UIView commitAnimations];
I will use curl down or up, according to the page being increased or decreased.
At some point the user can click on the chapter button and go a menu where he can choose the chapter. This menu is on a separate view, called using an animation like this
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:NO];
After the user chooses a chapter, I close the chapters choosing view using
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:NO];
and after this transition finishes, I call a method that will show the first page of the chosen chapter. This page will be shown using a page curl animation.
This is almost working fine, but this is the problem.
If I press the "choose a chapter" button again, instead of seeing a flip from right animation and see the "choose a chapter menu" I will see a page curl, that will review the same page I am already seeing and then, suddenly, the "choose a chapter menu" will appear, with no transition.
Is this something related to the animation being cached? Even if I declared the cache property as NO? How do I solve that?
thanks

Set some breakpoints. It sounds more like the "page curl" animation is being called spuriously.

Related

Animation on view

i have 2 toolbar one at top and another at bottom
in between of these two i have a webview and i apply a turn page animation on it.
But my problem is that on Animation both tool bar are also move with them how can i stop toolbar animation.only webview is animated
Thanks
[UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1];//0.3]; [UIView setAnimationDelegate:self]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:NO];
From your description, I think you are applying the animation on your main view (which contains the toolbars and the web view) and not on the web view only.
Post some code that might make things clearer.
EDIT:
Like i said you have applied the animation to your main view 'self.view' instead of your web view and hence the entire view is being animated..
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:NO];
instead try applying it to your web view:
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.myWebView cache:NO];

UIView Animation: Shrink

I'm looking to have my main view shrink to reveal the next view in the same way the Facebook app's views shrink when you press the top-left button. I already have it working with one of the included animations like this:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[self.navigationController popToRootViewControllerAnimated:YES];
[UIView commitAnimations];
However, since "Shrink" isn't one of the included animations, I'm a bit stuck. How could I make this shrink instead?
I'm fairly well-experienced with the iPhone SDK but haven't spent a lot of time with UIView animations.
Have you tried combining a scaling and translating transformation?
UIView's setAnimationTransition: method makes the packaged set of animations dirt simple, but if you want to do something else, you have to drop down a level and use Core Animation itself.
It isn't too bad: basically you use CATransaction's begin and commit methods and in between, get the view's layer and set its transform property directly. To shrink it you could set the scale to 0.00001, causing it to shrink.
Instead of removing the view right away, you will have to set a completion block and remove it yourself when the animation is done. And you might want to reset the transform back to normal, if you plan to use the view again.

Animate leafing through?

Is there any way to animate leafing through views to look like a real book leafing through?
There is always the option of using CoreAnimation to animate any view. For this purpose, it could become quite complex though.
There is a native animation for UIView that peels it up from the corner like a page. This kind of animation is more akin to leafing through a notepad than a book but it may just serve the purpose your looking for. If you wanted to do this it would look something like this:
[UIView setAnimationDuration:duration];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:view cache:NO];
[UIView commitAnimations];
The duration of the animation can be set to whatever you like.

iPhone SDK page flip and Page curl

I got the page flips and curls to work. I'll describe what happens...
I build and Go
The App opens in simulator
I press a button and the page curls to page 2... but when it gets to page 2 the page drops down a bit. Why does this happen?
if you're using view controllers, you shouldn't be adding their views manually, but should be using -[UINavigationController pushViewController:animated:]. There are ways to use these two techniques together, but that might be more trouble than it's worth. I'd suggest not using a viewController for your second, curled in view, until you're a bit more comfortable with the UIXXXController design pattern. Just add an outlet in your primary viewController for the paged-in view and hook it up in IB.
- (IBAction)goToSecondView {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:[self view]cache:YES];
[self.view addSubview:secondViewController.view];
[UIView commitAnimations];
}

Using of a single view to display different content on flip

I am trying to add a flip on row did select of every section.The flip side view should display the content of the selected section. I have tried to understand the apple transition tutorial but its tough to get.
Any simple application related to it .
Have you looked at the Apple Sample code? That is pretty well laid out and has a flip animation. If you create a default utility project, that code has pretty much nothing but flip code in it.
Generating a flip animation is very easy. You simply remove your main view (in your case the UITableView) and add your new view to the superView all inside a UIView animation block:
// start the animation block [UIView beginAnimations:nil context:NULL];
// Specify a flip transition
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
[myAppsWindow removeSubView:myUITableView]; // obiously replace these views with the correct views from your app.
[myAppsWindow addSubview:mybackView]; // you should build this view with your details in it.
// commit the animations. The animations will run when this invocation of the runloop returns.
[UIView commitAnimations];