Choppy/stuttering animation

Discussion in 'iOS Programming' started by r-ik, Sep 26, 2008.

  1. r-ik macrumors newbie

    Sep 26, 2008
    I recently started developing for the iPhone. So far it went quite well, but I ran into a animation problem. Actually the animation works fine but at one specific point the animation stutters.

    The situation
    My application has one large view of 4 screens wide (1280px) and 1 screen high (480px). It has this size because of the backgroundimage, some nice scenery. This large view can scroll to (4) fixed positions with touches or by some buttons. Each of those 4 positions covers a quarter of the large view.
    On position 1,3 and 4 only the backgroundimage is visible, no other views. At position 2 are the settings:
    - 3 uibuttons which contain each 2 uilabels, a uiview and a uiimageview
    - 1 uibutton containing an uiview with an uiimageview
    The animation between the different position is done with an animation block (UIView beginanimation etc).

    The problem
    The scrolling works really nice between positions, except scrolling to or from position 2. I don't think this position contains two many uiviews (?), but the animations stutters. When I look in Instruments there are no leaks and I don't see any other weird values.
    So I was wondering what might cause the stuttering. Which factors are critical for a smooth animation?

    Thanks for any reply!
  2. r-ik thread starter macrumors newbie

    Sep 26, 2008
    So far I didn't find THE solution, but the animation is now ok (but still not great). Before I used beginanimations of the UIView class, but now I wrote my own animation (with an easeOut) by changing the centre of the large view. The animation isn't as nice as it could be, but it's a lot smoother than it used to be.

    Although I found a workaround, I'd like to hear any good suggestions of any of you, how to improve it even more!
  3. r-ik thread starter macrumors newbie

    Sep 26, 2008

    Update: I found no good suggestions anywhere, so I just left it this way. I think it's working fine now.

    I finally submitted it to Apple and it's now available on the Appstore (search for 'iWakeUp'). It's a small app to wake you up in a nice way: 15 minutes before you have to get up, the background sound starts really quiet. In 15 minutes the volume reaches its max and then the alarm sound starts. There are 3 themes included, but in the update at least 7 can be downloaded (the update will probably be send to apple in a few days/a week).

    I'd like to hear what you think about the app, suggestions are welcome........

Share This Page