Animation on view - iphone

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];

Related

Need help in animating a Wheel on iphone

I am doing an application in iphone that need to spin the Dart Wheel when I drag on it. The view will have a dart wheel image and when we drag the wheel it spins and slowly it stops.
Can any one help me in doing this animation.
You can use CoreAnimation for the rotation animation:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration:1.0f];
[view.layer setTransform:CGAffineTransformMakeRotation(M_PI)];
[UIView commitAnimations];
You will have to tweak the animation for your needs.

iphone - wrong animations

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.

How can we turn views like turning a page in an iphone application?

Is it possible to turn a view slowly like turning a page? When i swipe from right to left, the current view will turn and the next view will be shown. And from left to right, the previous view will come slowly as we move the finger.
How can I do it? Any ideas??
You should add and remove subviews from your view by detecting the touch movements, using the animation transtion styles:
UIViewAnimationTransitionCurlUp //for removing views (vice-versa)
UIViewAnimationTransitionCurlDown // for adding views (vice-versa)
like:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:NO];
[self.view addSubview:nextView];
[UIView commitAnimations];
You should customize above according to ur needs.
Hope this helps.
Thanks,
Madhup

Animating UIView problem (matching the expanding animation to the shrinking animation)

I'm trying to animate a UIView so that it can grow larger when tapping a button and shrinks down to its original size by tapping the button again.
I do this by adjusting frame to its new size and origin and running the code below.
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
self.theView.frame = frame;
[UIView commitAnimations];
When animating to a bigger size the animation is how it should be. But when animating to its original size (smaller) the view is re-sized instantly and then animated to its designated location.
What I need is that the resizing to the smaller frame is animated as well.
I've tried adjusting the autoresizingMask as well, but that didn't change anything.
Hope someone can help.
thanks.
Michiel, Raj,
I made a youtube tutorial showing how to make views expand and shrink like in the facebook iPhone app.
Hope it can be of some help: How to make expanding/shrinking views on iPhone SDK
Adam
Try this
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationRepeatAutoreverses:YES];
self.theView.frame = frame;
[UIView commitAnimations];
In response to comment;
If you want to control animation reverse, have a flag like BOOL isbig and set it in app launch to NO, then toggle it in every button tap, then check it if it is YES or NO, and according to the result call a method. If NO, call your code, if not call the code again but this time set the frame to the original size.
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
self.theView.frame = originalFrame;
[UIView commitAnimations];
I could solve the problem by suggestion found in other thread, it has its own limitations though. I have posted the code in the same thread where the solution was suggested:
UIView scaling during animation
I worked around this problem when releasing my app by just removing the animation.
It kept bugging me in the back of my mind, so just this week I thought that maybe by using the center property and the size instead of the origin it would make a difference.
So I decided to test this out. Guess what. The problem doesn't occur when using sdk 4.x
Thanks all for trying to help me out.

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.