PDA

View Full Version : Animations [UIView beginAnimation]




sujithkrishnan
Aug 28, 2008, 05:50 AM
In my viewDidAppear of my viewController,....

i am giving....

[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:[self view] cache:YES];

within begin/commit block of animation...

Its not working.... But it is wrking for "UIViewAnimationTransitionFlip" kind...



Luke Redpath
Aug 28, 2008, 05:52 AM
Can you define "not working"? There is a bug in the iPhone simulator that means curl transitions only display as a simple fade.

On a related note, does anybody else find it annoying that the SDK doesn't provide a standard slide in/out transition (unless you are using a navigation controller which does it for you)?

PhoneyDeveloper
Sep 2, 2008, 04:24 PM
I had noticed that what was named a Curl animation seemed to be a fade. I like the fade. So does the curl actually curl on the phone? Is there a way that I can implement a simple fade animation?

I'm using UIWebView as an interface. I trap the link-presses and reload a dynamically generated page. UIWebView hesitates when you press a link so I have a simple animation that makes this transition from one web page to the next smooth using the curl animation, which you now say is a bug. I've done all my development on the simulator so how does this all look on the phone?

Luke Redpath
Sep 2, 2008, 04:48 PM
Look at the Maps application for an example of the curl animation.

PhoneyDeveloper
Sep 2, 2008, 11:47 PM
I think Maps isn't available on the Simulator. Guess I gotta get the iPod Touch I've looking at. Is an 8G iPod Touch sufficient for development work?

Luke Redpath
Sep 3, 2008, 02:09 AM
I use an iPhone but I guess its fine for most apps.

Taum
Sep 3, 2008, 04:04 AM
I had noticed that what was named a Curl animation seemed to be a fade. I like the fade. So does the curl actually curl on the phone? Is there a way that I can implement a simple fade animation?

Yes, the Curl animation seems to fade on the simulator but is actually a page curl in the iPhone/iPod touch.
You can create a fade animation fairly simply by animating the alpha property of a view.

PhoneyDeveloper
Sep 4, 2008, 01:18 PM
OK, I got a wild hair today and decided to figure out how to do a real fade animation. I tried the alpha animation but fading to white and back just doesn't look very good as a transition. In the end it's only a few lines of code. This looks pretty near identical to the fade/curl transition that I had before.

This code runs in my view controller for a webview:

[CATransaction begin];
CATransition *animation = [CATransition animation];
animation.type = kCATransitionFade;
animation.duration = 0.15;

[mWebView loadData:data MIMEType:@"text/html" textEncodingName:@"utf-8" baseURL:nil];

// Commit the animation
[[self.view layer] addAnimation:animation forKey:@"myanimationkey"];
[CATransaction commit];

RobertBlackburn
Oct 7, 2008, 05:23 PM
Hi i tried the code you supplied and got it working in one of my apps but i am having a slight problem with it.

When the app starts and the device is portrait the fade works fine and smooth.

If i rotate the device the app rotates as it should, i then put the device back to portrait, rotates as it should. Then when i use the fade transition again it is slower and noticeably jerky and stays this way until the app is reset :confused:

have you had any experience of this or know what would be causing it to do this?

i am just lost for ideas now on how to fix it

PhoneyDeveloper
Oct 7, 2008, 07:34 PM
I haven't seen any problem with the fade transition slowing down. I just did try to rotate my app from portrait to landscape and back. I let the app do a bunch of transitions before and after and didn't see any problems.

You might want to check with the performance tools to see what code is being called when it gets slow. Is it possible that your app is using using a lot of memory and that's what's causing the slowdown? One other thought, views get resized and repositioned after rotations. Maybe some views are in odd positions or are not on integral coordinate boundaries and that slows things down. (just a guess) You could try hiding some views or otherwise removing them to see if any particular view is causing the slowdown.