Animations [UIView beginAnimation]

Discussion in 'iOS Programming' started by sujithkrishnan, Aug 28, 2008.

  1. macrumors 6502

    May 9, 2008
    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...
  2. macrumors 6502a

    Nov 9, 2007
    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)?
  3. macrumors 68030


    Sep 2, 2008
    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?
  4. macrumors 6502a

    Nov 9, 2007
    Look at the Maps application for an example of the curl animation.
  5. macrumors 68030


    Sep 2, 2008
    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?
  6. macrumors 6502a

    Nov 9, 2007
    I use an iPhone but I guess its fine for most apps.
  7. macrumors member

    Jul 28, 2008
    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.
  8. macrumors 68030


    Sep 2, 2008
    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];
  9. macrumors newbie

    Oct 7, 2008
    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
  10. macrumors 68030


    Sep 2, 2008
    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.

Share This Page